Databases
Add MongoDB to your application
Add MongoDB to your application
To add a MongoDB instance to your application:
- Open the application from the Dashboard.
- Click on Data Sources in the left-hand nav
- Click on Add Source in the sub-nav
- Click the green + Add Data Source button and select MongoDB
- A drawer will open from the left, with configuration options for the server.
- Click Add Server to start the process
If you need more help, please read our how-to guide on managing databases in Cloud 66.
Managing users in MongoDB
We support MongoDB authentication by default, and so we will generate a database user and admin user along with passwords.
All instances of MongoDB managed by Cloud 66 have an additional logical database named admin
. All the users for any logical databases added to a physical MongoDB database group (via Cloud 66’s interfaces) are added to (and queried from) admin
.
For the database user, we set the following roles inside MongoDB:
["readWriteAnyDatabase", "dbAdminAnyDatabase"]
For the admin user, we set the following roles inside MongoDB:
["root", { role: "dbAdmin", db: "local" }, { role: "dbAdmin", db: "config" }]
The admin user can only access the database via 127.0.0.1
so it cannot be used via external IP addresses.
Logging into a secondary logical database
When you connect to a logical MongoDB database, MongoDB will assume you are using a “local” user (i.e. a user whose credentials are stored in the database to which you are connecting). As such if you need to connect to such a database, you will need to add the following flag to the database URL: ?authSource=admin
For example:
mongodb://USERNAME:PASSWORD@hellogoose.com:27017/DATABASE?authSource=admin