Mongo in the Cloud
by John Vincent
Posted on April 16, 2017
Setup a Mongo Database at mLab
Setting up a Mongo Database is straightforward.
Getting Started
Get an account at mLab if you do not already have one.
Using mLab
Sign in to mLab
MongoDB Deployments
- Create New
Single-node (free)
- Sandbox (free)
- Note MongoDB version
Database Name: jv-test-1
Click Create new MongoDB deployment
Create a User
- Select Database
- Users Tab
- Click Add database user
- Create User, user =
jvtest
To connect using the mongo shell:
mongo ds117348.mlab.com:17348/jv-test-1 -u <dbuser> -p <dbpassword>
To connect using a driver via the standard MongoDB URI (what's this?):
mongodb://<dbuser>:<dbpassword>@ds117348.mlab.com:17348/jv-test-1
Download Mongo Data
Import Data
mongoimport --db jv-test-1 --collection restaurants --drop --file primer-dataset.json --host ds117348.mlab.com --port 17348 -u jvtest -p <password>
- Connect to the database
mongo ds117348.mlab.com:17348/jv-test-1 -u jvtest -p <password>
- Verify data
use jv-test-1
db.restaurants.find()