Mongo Cheatsheet

robomongo is an awesome GUI clicky tool.

Connect to the DB:

mongo <target>

Get host information:


Show users:

db.runCommand( { usersInfo: 1 } )

Show roles:

show roles

Show databases:

show dbs

Use a database:

use <db name>

Show tables:

// or
show tables
// or
show collections

Get data in a table:

db.<table name>.find()

Get version of mongo:


Get json dump of the data

Create export.js file
Put this into it:

profileData = db.<collection name>.find();
// for example: db.system.users
while(profileData.hasNext()) {

Run it like so:

mongo *ip of host*/*db name* export.js > *json file name*.json