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/
分享到:
相关推荐
mongo db 0801
Mongo DB 3.2.5官方帮助文档
Mongo DB 服务安装,版本4.4,本地数据存储,非关型数据库服务安装。
resfult for mongo db
Mongo DB 客户端 破解版,保证可以使用。
Mongo DB 基础培训资料,比较详细,是我同事整理总结的
Mongo DB 权威指南 中文版
Mongo DB数据库日常常用操作命令大全集合,适用于初学MONGO DB的人员掌握基本命令
MongoDB的实用性着实令人着迷。MongoDB并不去迎合所有人的全部需求。它在功能和复杂性之间取得很好的平衡,并且将原先十分复杂的任务大大简化。也就是说,它具备支撑今天主流web应用的关键功能:索引,复制,分片,...
mongo db demo
mongo db introduction
Mongo Db Course - M001 MongoDB Basics https://university.mongodb.com/courses/M001/2022_May_10/completion
mongoDB客户端破解版使用方法: 解压后安装Installer-1.6.9下的Installer,然后把MongoVUE破解版目录下的MongoVUE拷贝到刚刚你安装的目录下,替换即可。
sql-to-mongo-db-query-converter sql-to-mongo-db-query-converter可帮助您基于SQL中提供的查询为MongoDb构建查询。玛文向com.github.vincentrussell:sql-to-mongo-db-query-converter添加依赖...
MongoDB的实用性着实令人着迷。MongoDB并不去迎合所有人的全部需求。它在功能和复杂性之间取得很好的平衡,并且将原先十分复杂的任务大大简化。也就是说,它具备支撑今天主流web应用的关键功能:索引,复制,分片,...
MongoDB的实用性着实令人着迷。MongoDB并不去迎合所有人的全部需求。它在功能和复杂性之间取得很好的平衡,并且将原先十分复杂的任务大大简化。也就是说,它具备支撑今天主流web应用的关键功能:索引,复制,分片,...
CentOS 安装mongoDb,1.下载&安装说明2.MongoDB CRUD简单说明
CI框架的mongo_db数据库扩展链接文件,有了它,CI框架链接mongo_db不在烦恼!
Mongo DB示例代码 这是简单的Rest API中的一些样例Mongo DB代码,该代码具有基本的CRUD终结点,以供参考。 安装 要运行此示例代码,请安装npm软件包并运行server.js文件。 npm install node server Mongo DB入门 ...
node-mongodb-native, Mongo DB原生NodeJS驱动程序 描述官方的 MongoDB驱动程序。 在核心插件之上提供一个高级 API,这意味着最终用户。的MongoDB node.js-驱动程序什么地方文档http://mongodb.github.io