更新时间:2026-09-24 GMT+08:00

支持与限制的命令

用户在连接到文档数据库后,需要关注以下支持以及限制的命令。

更多信息,请参见MongoDB官方文档。

如下表所示,“√”表示当前版本支持该命令,“×”表示当前版本不支持该命令。

表1 支持与限制的命令

命令类别

命令名称

3.4

4.0

4.2

备注

Aggregates Commands

aggregate

√

√

√

-

count

√

√

√

-

distinct

√

√

√

-

group

√

√

√

-

mapReduce

√

√

√

在DDS实例关联参数模板中设置参数“security.javascriptEnabled”的值为“true”后,可以使用该命令。更多信息,请参见如何使用MapReduce命令。

Geospatial Commands

geoNear

√

√

√

-

geoSearch

√

√

√

-

Query and Write Operation Commands

find

√

√

√

-

insert

√

√

√

-

update

√

√

√

-

delete

√

√

√

-

findAndModify

√

√

√

-

getMore

√

√

√

-

getLastError

√

√

√

-

resetError

√

√

√

-

getPrevError

√

√

√

-

parallelCollectionScan

√

√

√

-

Query Plan Cache Commands

planCacheListFilters

√

√

√

-

planCacheSetFilter

√

√

√

-

planCacheClearFilters

√

√

√

-

planCacheListQueryShapes

√

√

√

-

planCacheListPlans

√

√

√

-

planCacheClear

√

√

√

-

Authentication Commands

logout

√

√

√

-

authenticate

√

√

√

-

copydbgetnonce

√

√

√

-

getnonce

√

√

√

-

authSchemaUpgrade

x

x

x

系统内部命令。

User Management Commands

createUser

√

√

√

-

updateUser

√

√

√

-

dropUser

√

√

√

-

dropAllUsersFromDatabase

√

√

√

-

grantRolesToUser

√

√

√

-

revokeRolesFromUser

√

√

√

-

usersInfo

√

√

√

-

Role Management Commands

invalidateUserCache

√

√

√

-

createRole

√

√

√

-

updateRole

√

√

√

-

dropRole

√

√

√

-

dropAllRolesFromDatabase

√

√

√

-

grantPrivilegesToRole

√

√

√

-

revokePrivilegesFromRole

√

√

√

-

grantRolesToRole

√

√

√

-

revokeRolesFromRole

√

√

√

-

rolesInfo

√

√

√

-

Replication Commands

replSetElect

x

x

x

系统内部命令。

replSetUpdatePosition

x

x

x

系统内部命令。

appendOplogNote

x

x

x

系统内部命令。

replSetFreeze

x

x

x

系统内部命令。

replSetGetStatus

√

√

√

-

replSetInitiate

x

x

x

系统内部命令。

replSetMaintenance

x

x

x

系统内部命令。

replSetReconfig

x

x

x

系统内部命令。

replSetStepDown

x

x

x

系统内部命令。

replSetSyncFrom

x

x

x

系统内部命令。

replSetRequestVotes

x

x

x

系统内部命令。

replSetDeclareElectionWinner

x

x

x

系统内部命令。

resync

x

x

x

系统内部命令。

applyOps

x

x

x

系统内部命令。

isMaster

√

√

√

-

replSetGetConfig

x

x

x

系统内部命令。

Sharding Commands

flushRouterConfig

√

√

√

高危命令。

addShard

x

x

x

越权操作。

addShardToZone

√

√

√

-

balancerStart

√

√

√

-

balancerStatus

√

√

√

-

balancerStop

√

√

√

-

removeShardFromZone

√

√

√

-

updateZoneKeyRange

√

√

√

-

cleanupOrphaned

x

x

x

高危命令。

checkShardingIndex

x

x

x

系统内部命令。

enableSharding

√

√

√

-

listShards

x

x

x

系统内部命令。

removeShard

x

x

x

高危命令。

getShardMap

x

x

x

系统内部命令。

getShardVersion

√

√

√

-

mergeChunks

√

√

√

-

setShardVersion

x

x

x

系统内部命令。

shardCollection

√

√

√

-

shardingState

x

x

x

系统内部命令。

unsetSharding

x

x

x

系统内部命令。

split

√

√

√

-

splitChunk

√

√

√

-

splitVector

√

√

√

-

moveChunk

√

√

√

-

movePrimary

√

√

√

-

isdbgrid

√

√

√

-

Administration Commands

setFeatureCompatibilityVersion

√

√

√

-

renameCollection

√

√

√

-

dropDatabase

√

√

√

-

listCollections

√

√

√

-

drop

√

√

√

-

create

√

√

√

-

clone

x

x

x

系统内部命令。

cloneCollection

√

√

√

-

cloneCollectionAsCapped

√

√

√

-

convertToCapped

√

√

√

-

filemd5

√

√

√

-

createIndexes

√

√

√

-

listIndexes

√

√

√

-

dropIndexes

√

√

√

-

fsync

√

√

√

-

clean

x

x

x

系统内部命令。

connPoolSync

x

x

x

系统内部命令。

connectionStatus

√

√

√

-

compact

x

x

x

高危命令。

collMod

√

√

√

-

reIndex

√

√

√

-

setParameter

x

x

x

系统配置命令。

getParameter

√

√

√

-

repairDatabase

x

x

x

高危命令。

repairCursor

x

x

x

系统内部命令。

touch

√

√

√

-

shutdown

x

x

x

高危命令。

logRotate

x

x

x

高危命令。

killOp

√

√

√

-

releaseFreeMemory

√

√

√

-

Diagnostic Commands

availableQueryOptions

√

√

√

-

buildInfo

√

√

√

-

collStats

√

√

√

-

connPoolStats

x

x

x

系统内部命令。

cursorInfo

x

x

x

系统内部命令。

dataSize

√

√

√

-

dbHash

x

x

x

系统内部命令。

dbStats

√

√

√

-

diagLogging

x

x

x

系统内部命令。

driverOIDTest

x

x

x

系统内部命令。

explain

√

√

√

-

features

√

√

√

-

getCmdLineOpts

x

x

x

系统内部命令。

getLog

x

x

x

系统内部命令。

hostInfo

x

x

x

系统内部命令。

isSelf

x

x

x

系统内部命令。

listCommands

√

√

√

-

listDatabases

√

√

√

-

netstat

x

x

x

系统内部命令。

ping

√

√

√

-

profile

√

√

√

-

serverStatus

√

√

√

-

shardConnPoolStats

x

x

x

系统内部命令。

top

√

√

√

-

validate

x

x

x

系统配置命令。

whatsmyuri

√

√

√

-

Internal Commands

handshake

x

x

x

系统内部命令。

_recvChunkAbort

x

x

x

系统内部命令。

_recvChunkCommit

x

x

x

系统内部命令。

_recvChunkStart

x

x

x

系统内部命令。

_recvChunkStatus

x

x

x

系统内部命令。

_replSetFresh

x

x

x

系统内部命令。

mapreduce.shardedfinish

x

x

x

系统内部命令。

_transferMods

x

x

x

系统内部命令。

replSetHeartbeat

x

x

x

系统内部命令。

replSetGetRBID

x

x

x

系统内部命令。

_migrateClone

x

x

x

系统内部命令。

replSetElect

x

x

x

系统内部命令。

writeBacksQueued

x

x

x

系统内部命令。

writebacklisten

x

x

x

系统内部命令。

System Events Auditing Commands

logApplicationMessage

x

x

x

系统内部命令。