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:
![](https://static.packt-cdn.com/products/9781789343533/graphics/assets/1067c37b-4428-44a8-a903-0e9209b22818.png)
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:
![](https://static.packt-cdn.com/products/9781789343533/graphics/assets/eaa342a4-2560-4051-92a1-defba0924197.png)