On this page本页内容
All command documentation outlined below describes a command and its available parameters and provides a document template or prototype for each command. 下面列出的所有命令文档都描述了一个命令及其可用参数,并为每个命令提供了一个文档模板或原型。Some command documentation also includes the relevant 一些命令文档还包括相关的mongosh helpers.mongosh助手。
To run a command against the current database, use 要对当前数据库运行命令,请使用db.runCommand():db.runCommand():
db.runCommand( { <command> } )
To run an administrative command against the 要对admin database, use db.adminCommand():admin数据库运行管理命令,请使用db.adminCommand():
db.adminCommand( { <command> } )
For details on specific commands, including syntax and examples, click on the specific command to go to its reference page.有关特定命令的详细信息,包括语法和示例,请单击特定命令以转到其参考页面。
When you run a database command, you specify the command as a document to 运行数据库命令时,将该命令指定为db.runCommand(). db.runCommand()的文档。The document's key is the command to run, and the value is typically supplied as 文档的键是要运行的命令,值通常为1. 1。The value does not affect the output of the command for example:该值不影响命令的输出,例如:
db.runCommand( { hello: 1 } )
aggregate | $group using an aggregation pipeline.$group。 |
count | |
distinct | |
mapReduce |
geoSearch |
delete | |
find | |
findAndModify | |
getMore | |
insert | |
resetError | |
update |
planCacheClear | |
planCacheClearFilters | |
planCacheListFilters | |
planCacheSetFilter |
authenticate | |
getnonce | |
logout |
createUser | |
dropAllUsersFromDatabase | |
dropUser | |
grantRolesToUser | |
revokeRolesFromUser | |
updateUser | |
usersInfo |
createRole | |
dropRole | |
dropAllRolesFromDatabase | |
grantPrivilegesToRole | |
grantRolesToRole | |
invalidateUserCache | |
revokePrivilegesFromRole | |
revokeRolesFromRole | |
rolesInfo | |
updateRole |
applyOps | |
hello | |
replSetAbortPrimaryCatchUp | |
replSetFreeze | |
replSetGetConfig | |
replSetGetStatus | |
replSetInitiate | |
replSetMaintenance | RECOVERING state.RECOVERING状态。 |
replSetReconfig | |
replSetResizeOplog | |
replSetStepDown | |
replSetSyncFrom |
Replication for more information regarding replication.副本以获取有关副本的更多信息。
abortReshardCollection |
|
addShard | |
addShardToZone | |
balancerCollectionStatus |
|
balancerStart | |
balancerStatus | |
balancerStop | |
checkShardingIndex | |
clearJumboFlag | jumbo flag for a chunk.jumbo标志。 |
cleanupOrphaned | |
cleanupReshardCollection |
|
commitReshardCollection |
|
enableSharding | |
flushRouterConfig | mongod/mongos instance to update its cached routing metadata.mongod/mongos实例更新其缓存的路由元数据。 |
getShardMap | |
getShardVersion | |
isdbgrid | mongos.mongos。 |
listShards | |
medianKey | splitVector.splitVector。 |
moveChunk | |
movePrimary | |
mergeChunks | |
refineCollectionShardKey |
|
removeShard | |
removeShardFromZone | |
reshardCollection |
|
setShardVersion | |
shardCollection | |
shardingState | mongod is a member of a sharded cluster.mongod是否为分片群集的成员。 |
split | |
splitVector | |
unsetSharding | |
updateZoneKeyRange |
abortTransaction |
|
commitTransaction |
|
endSessions | |
killAllSessions | |
killAllSessionsByPattern | |
killSessions | |
refreshSessions | |
startSession |
cloneCollectionAsCapped | |
collMod | |
compact | |
connPoolSync | |
convertToCapped | |
create | |
createIndexes | |
currentOp | |
drop | |
dropDatabase | |
dropConnections | |
dropIndexes | |
filemd5 | |
fsync | |
fsyncUnlock | |
getDefaultRWConcern |
|
getParameter | |
killCursors | |
killOp | |
listCollections | |
listDatabases | |
listIndexes | |
logRotate | |
reIndex | |
renameCollection | |
rotateCertificates | |
setFeatureCompatibilityVersion | |
setIndexCommitQuorum | |
setParameter | |
setDefaultRWConcern |
|
shutdown | mongod or mongos process.mongod或mongos进程。 |
buildInfo | |
collStats | |
connPoolStats | |
connectionStatus | |
cursorInfo | metrics.cursor.metrics.cursor。 |
dataSize | |
dbHash | |
dbStats | |
driverOIDTest | |
explain | |
features | |
getCmdLineOpts | |
getLog | |
hostInfo | |
_isSelf | |
listCommands | mongod instance.mongod实例提供的所有数据库命令。 |
lockInfo | mongod instances.mongod实例。
|
netstat | mongos instances.mongos实例。 |
ping | |
profile | |
serverStatus | |
shardConnPoolStats | connPoolStats instead.connPoolStats代替。 |
top | mongod instance.mongod实例中每个数据库的原始使用统计信息。 |
validate | |
whatsmyuri |
setFreeMonitoring |
logApplicationMessage |