Mongo Cheatsheet

robomongo is an awesome GUI clicky tool.

Connect to the DB:

mongo <target>

Get host information:

db.adminCommand({"hostInfo":1})

Show users:

db.runCommand( { usersInfo: 1 } )

Show roles:

show roles

Show databases:

show dbs

Use a database:

use <db name>

Show tables:

db.getCollectionNames()
// or
show tables
// or
show collections

Get data in a table:

db.<table name>.find()

Get version of mongo:

db.version()

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()) {
      printjson(profileData.next());
}

Run it like so:

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