MongDB shell 命令

db.help()                    help on db methods
db.mycoll.help()             help on collection methods
sh.help()                    sharding helpers
rs.help()                    replica set helpers
help admin                   administrative help
help connect                 connecting to a db help
help keys                    key shortcuts
help misc                    misc things to know
help mr                      mapreduce

show dbs                     显示所有的数据库
show collections             显示当前数据库的所有表
show users                   show users in current database
show profile                 show most recent system.profile entries with time >= 1ms
show logs                    show the accessible logger names
show log [name]              prints out the last segment of log in memory, 'global' is default
use <db_name>                切换or创建一个数据库
db.foo.find()                列出foo collection(表)上的所有对象
db.foo.find( { a : 1 } )     列出foo表上所有a == 1的对象
it                           result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x   set default number of items to display on shell
exit                         quit the mongo shell

你可能感兴趣的:(mongdb-命令集)