As with transactions, when adding security, we need to modify the MongoDB connection string. Assuming that we are using x.509 certificates, and assuming that we have created a database user zed, here is the modified Application/init.php file:
And this is the connect string which is produced:
mongodb://zed:password@mongod/sweetscomplete?ssl=1&replicaSet=sweets_11&authSource=admin
The MongoDB conf file also needs to be modified, as described in Chapter 7, Securing MongoDB: