List of available commands in MongoDB

Following are the list of commands available in MongoDB.

Command Usage
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 database names
show collections show collections in current database
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
use set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 3 } ) list objects in foo where a == 3
it result of the last line evaluated
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
Ctrl A Start of line
Ctrl E End of the line
Ctrl K del to end of the line

Examples:

> show dbs
local 0.000GB
> use local
switched to db local
> use test
switched to db test
>

CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: