mongod实例的写操作命令(增、删、改)由write_commands.cpp文件实现,该文件中的CmdInsert、CmdDelete、CmdUpdate类分别对应具体的增、删、改命令操作。读操作命令由find_cmd.cpp文件实现,对应命令类为FindCmd 除了mongod实例,mongos作为代理转发节点,同样支持增、删、改操作。mongodb内核实现的时候,如果集群部署是shard...
16. directory 17. -d [ --db ] arg database to use 18. -c [ --collection ] arg collection to use (some commands) 19. -f [ --fields ] arg comma separated list of field names e.g. -f name,age 20. --fieldFile arg file with fields names - 1 per line 21. --ignoreBlanks i...
if cmdObj is a string, turns it into { cmdObj : 1 } db.serverStatus() db.setLogLevel(level,) db.setProfilingLevel(level,) 0=off 1=slow 2=all db.setWriteConcern( ) - sets the write concern for writes to the db db.unsetWriteConcern( ) - unsets the write concern for writes t...
if (!retval) { 31. command->incrementCommandsFailed(); 32. } 33. ... 34.} execCommandDatabase(...)最终调用RunCommandImpl(...)进行对应命令的真正处理,该接口核心代码实现如下: 1.bool runCommandImpl(...) { 2. //获取命令请求内容body 3. BSONObj cmd = request.body; 4. //获取请求中的...
killOp(opid) kills the current operation in the db26db.listCommands() lists all the db commands27db.printCollectionStats()28db.printReplicationInfo()29db.printSlaveReplicationInfo()30db.printShardingStatus()31db.removeUser(username)32db.repairDatabase()33db.resetError()34db.runCommand(cmdObj) ...
listCommands() lists all the db commands db.loadServerScripts() loads all the myscripts in db.system.js db.logout() db.printCollectionStats() db.printReplicationInfo() db.printShardingStatus() db.printSlaveReplicationInfo() db.resetError() db.runCommand(cmdObj) run a database command. if...
setVerboseShell(flag) display extra information in shell output db.shutdownServer() db.stats() db.version() current version of the server 对数据库进行管理和操作的基本命令,可以从上面获取到。如果想要得到更多,而且每个命令的详细用法,可以使用上面列出的db.listCommands()查询。另一个比较基础的是对指定...
security_commands.cpp:安全指令,CmdGetNonce,CmdLogout,CmdAuthenticate commands_admin.cpp:shard管理操作,因其位于mongos项目,这里暂不介绍 commands_public.cpp:shard公用操作,因其位于mongos项目,这里暂不介绍 下面是相关类图: ---分割线--- ---分割线--- ---分割线---...
We’ve already seen a couple of commands in the previous chapters; for instance, we used the getLastError command in Chapter 3 to check the number of documents affected by an update: > db.count.update({x : 1}, {$inc : {x : 1}}, false, true) > db.runCommand({getLastError : 1}...
打印从数据库的复制状态信息 db.printShardingStatus() 打印分⽚状态信息 db.removeUser(username) 删除数据库⽤户 db.repairDatabase() 修复数据库 db.resetError()db.runCommand(cmdObj) run a database command. if cmdObj is a string, turns it into { cmdObj : 1 } ...