您的位置:首页 > 运维架构 > Linux

linux目录规则

2015-08-23 19:54 483 查看
1.  

The MongoDB command interface
provides access to all non CRUD

database operations.

 
 
2.  

A command is sent to the
database as a query to a special collection namespace called
$cmd


. The
database will return a single document with the command results:

db.$cmd.findOne( { <commandname>: <value> [, options] } );

 
 
The shell provides a helper function for this:

db.runCommand( { <commandname>: <value> [, options] } );

 
 
 
3.  

All commands return, at
minimum, a document with an ok

field indicating whether the command has
succeeded:

{ 'ok': 1 }

 
 
If the command fails, the value of ok

will be 0.

 
4. 

For many db commands, some
drivers implement wrapper methods to make usage easier. To check our database's
current profile level setting:

> db.runCommand({profile:-1});

{

"was" : 0.0 ,

"ok" : 1.0

}

 
Or, you can use a corresponding wrapper method:

 
 

> db.getProfilingLevel()

0.0

 
Its implementation is:

 

> print( db.getProfilingLevel )

function () {

var res = this._dbCommand({profile:-1});

return res ? res.was : null;

}

> print( db._dbCommand )

function (cmdObj) {

return this.$cmd.findOne(cmdObj);

}

 
 
5. 

Certain operations are for the
database administrator only. These privileged operations may only be performed
on the special database named admin

:

> use admin;

> db.runCommand("shutdown"); // shut down the database

 
If the db

variable is not set to 'admin

', you can use adminCommand


(_adminCommand

in versions earlier than 1.8

) to switch to the right database
automatically (and just for that operation):

> db.adminCommand("shutdown");

 

6.  

Use commandHelp

in shell to get
help info for a command:

> db.commandHelp("datasize")

 
 
 

7.  

For detailed command reference,
please refer :

http://docs.mongodb.org/manual/reference/commands/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: