Mongo Cheatsheet
robomongo is an awesome GUI clicky tool.Connect to the DB:Get host information:db.adminCommand({ hos 2017-2-18 07:36:16 Author: techvomit.net(查看原文) 阅读量:0 收藏

robomongo is an awesome GUI clicky tool.

Connect to the DB:

Get host information:

db.adminCommand({ hostInfo: 1 });

Show users:

db.runCommand({ usersInfo: 1 });

Show roles:

Show databases:

Use a database:

Show tables:

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

Get data in a table:

Get version of mongo:

Get json dump of the data

Create export.js with the following:

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

文章来源: https://techvomit.net/mongo-cheatsheet/
如有侵权请联系:admin#unsafe.sh