Getting Started with Private MongoDB Server

Overview

After your Private MongoDB Server has been ordered and provisioned, you can start creating databases through the Everleap Control Panel, under Databases > Private MongoDB.

Please note that you will not be able to create databases through the mongo shell. dbOwner rights are automatically granted to your primary database login for each database you create through our Control Panel.

Creating a database

  1. Log in to the Private MongoDB section of the Control Panel.
  2. Enter the database name and click on the Create Database button.

Deleting a database

  1. Log in to the Private MongoDB section of the Control Panel.
  2. Click on the Delete link next to the database.

Changing the primary database login password

  1. Log in to the Private MongoDB section of the Control Panel.
  2. Click on the Change Password link.
  3. Enter your new password and click on the Update Password button.

Your MongoDB connection string

Your MongoDB connection string for use in your application has the following format:

mongodb://username:password@server_name.everleap.com:27017/database_name

where username, password, server_name and database_name are values you supply. You can find the server and database names in the Control Panel.

Before using the command line tools

The instructions below presuppose that you have the MongoDB binaries installed somewhere on your local machine. If you do not have them, you can get them here.

Connecting to the server via the mongo shell

At the command prompt, type in:

mongo.exe --host server_name.everleap.com/database_name --port 27017 -u username -p password --authenticationDatabase admin

where server_name, database_name, username and password are values you supply. Please note that "/database_name" is optional.

Backing up your MongoDB database

At the command prompt, type in:

mongodump.exe /host:server_name /port:27017 /authenticationDatabase:admin /user:username /password:password /db:database_name /out:file_directory_path

where server_name, database_name, username and password are values you supply. The file_directory_path is a local path on your machine.

Restoring your MongoDB database

At the command prompt, type in:

mongorestore.exe /host:server_name /port:27017 /authenticationDatabase:admin /user:username /password:password /drop /db:database_name file_directory_path

where server_name, database_name, username and password are values you supply. The file_directory_path is a local path on your machine where the backup resides.

Creating additional users

Follow the instructions above to connect to your server via the mongo shell with your primary database user login, then type in:

use database_name
db.createUser({ "user" : "username", "pwd" : "password", "roles" : [ { "role" : "role", "db" : "database_name" } ] })

where username, password, role and database_name are values you supply. Valid roles include read, readWrite, dbAdmin, dbOwner, userAdmin, and any custom defined roles. For more information, please see MongoDB's built-in roles reference.

Verify it worked

Connect to the server with the mongo shell using your primary database login. If the connection succeeds and use database_name switches to the database you created in the Control Panel, everything is set up correctly.

Notes

  • Take your own backups. The Everleap Website Cloud Backup service will not back up Private MongoDB Servers. The mongodump instructions above are how you protect your data.
  • Databases must be created through the Control Panel, not through the mongo shell.
  • Your primary database login is granted dbOwner rights automatically on each database you create in the Control Panel.

Related Articles