MongoDB List of Commands
S:slave-ok R:read-lock W:write-lock A:admin-onlyCommand | Attributes | Help |
---|---|---|
killOp | UNUSED S A | |
rolesInfo | UNUSED | Returns information about roles. |
planCacheSetFilter | UNUSED | Sets index filter for a query shape. Overrides existing filter. |
cloneCollectionAsCapped | UNUSED | { cloneCollectionAsCapped:<fromName>, toCollection:<toName>, size:<sizeInBytes> } |
dbHash | UNUSED S | |
revokeRolesFromUser | UNUSED | Revokes roles from a user. |
parallelCollectionScan | UNUSED S | |
getnonce | UNUSED S | internal |
getMore | UNUSED S | retrieve more results from an existing cursor |
compact | UNUSED S | compact collection warning: this operation locks the database and is slow. you can cancel with killOp() { compact : <collection_name>, [force:<bool>], [validate:<bool>], force - allows to run on a replica set primary validate - check records are noncorrupt before adding to newly compacting extents. slower but safer (defaults to true in this version) |
group | UNUSED | http://dochub.mongodb.org/core/aggregation |
planCacheListPlans | UNUSED | Displays the cached plans for a query shape. |
dropDatabase | UNUSED | drop (delete) this database |
shardingState | UNUSED S A | |
mergeChunks | UNUSED A | Merge Chunks command usage: { mergeChunks : <ns>, bounds : [ <min key>, <max key> ], (opt) epoch : <epoch>, (opt) config : <configdb string>, (opt) shardName : <shard name> } |
logout | UNUSED S | de-authenticate |
update | UNUSED | update documents |
isMaster | UNUSED S | Check if this server is primary for a replica pair/set; also if it is --master or --slave in simple master/slave setups.{ isMaster : 1 } |
ping | UNUSED S | a way to check that the server is alive. responds immediately even if server is in a db lock. |
grantPrivilegesToRole | UNUSED | Grants privileges to a role |
createIndexes | UNUSED | |
connPoolStats | UNUSED S | stats about connections between servers in a replica set or sharded cluster. |
_configsvrRemoveShardFromZone | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Validates and removes the shard from the zone. |
invalidateUserCache | UNUSED S A | Invalidates the in-memory cache of user information |
listDatabases | UNUSED A | { listDatabases:1, [filter: <filterObject>] [, nameOnly: true ] } list databases on this server |
shutdown | UNUSED S A | shutdown the database. must be ran against admin db and either (1) ran from localhost or (2) authenticated. If this is a primary in a replica set and there is no member within 10 seconds of its optime, it will not shutdown without force : true. You can also specify timeoutSecs : N to wait N seconds for other members to catch up. |
dropAllRolesFromDatabase | UNUSED | Drops all roles from the given database. Before deleting the roles completely it must remove them from any users or other roles that reference them. If any errors occur in the middle of that process it's possible to be left in a state where the roles have been removed from some user/roles but otherwise still exist. |
connPoolSync | UNUSED S | internal |
setShardVersion | UNUSED S A | internal |
fsync | UNUSED S A | http://dochub.mongodb.org/core/fsynccommand |
usersInfo | UNUSED | Returns information about users. |
authSchemaUpgrade | UNUSED A | Upgrades the auth data storage schema |
logRotate | UNUSED S A | |
insert | UNUSED | insert documents |
geoSearch | UNUSED S | |
delete | UNUSED | delete documents |
replSetStepDown | UNUSED S A | { replSetStepDown : <seconds> } Step down as primary. Will not try to reelect self for the specified time period (1 minute if no numeric secs value specified, or secs is 0). (If another member with same priority takes over in the meantime, it will stay primary.) http://dochub.mongodb.org/core/replicasetcommands |
validate | UNUSED S | Validate contents of a namespace by scanning its data structures for correctness. Slow. Add full:true option to do a more thorough check |
collStats | UNUSED S | { collStats:"blog.posts" , scale : 1 } scale divides sizes e.g. for KB use 1024avgObjSize - in bytes |
getShardVersion | UNUSED A | example: { getShardVersion : 'alleyinsider.foo' } |
replSetInitiate | UNUSED S A | Initiate/christen a replica set. http://dochub.mongodb.org/core/replicasetcommands |
whatsmyuri | UNUSED S | {whatsmyuri:1} |
serverStatus | UNUSED S | returns lots of administrative server statistics |
checkShardingIndex | UNUSED | Internal command. |
resetError | UNUSED S | reset error state (used with getpreverror) |
_configsvrMoveChunk | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Requests the balancer to move or rebalance a single chunk. |
_configsvrBalancerStop | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Controls the balancer state. |
findAndModify | UNUSED | { findAndModify: "collection", query: { findAndModify: "collection", query: Either update or remove is required, all other fields have default values. Output is in the "value" field |
dbStats | UNUSED S | Get stats on a database. Not instantaneous. Slower for databases with large .ns files. Example: { dbStats:1, scale:1 } |
forceerror | UNUSED S | for testing purposes only. forces a user assertion exception |
dropUser | UNUSED | Drops a single user. |
cleanupOrphaned | UNUSED A | |
getPrevError | UNUSED S | check for errors since last reseterror commandcal |
_recvChunkAbort | UNUSED A | internal |
availableQueryOptions | UNUSED S | |
replSetMaintenance | UNUSED S A | { replSetMaintenance : bool } Enable or disable maintenance mode. |
updateUser | UNUSED | Used to update a user, for example to change its password |
dropRole | UNUSED | Drops a single role. Before deleting the role completely it must remove it from any users or roles that reference it. If any errors occur in the middle of that process it's possible to be left in a state where the role has been removed from some user/roles but otherwise still exists. |
revokePrivilegesFromRole | UNUSED | Revokes privileges from a role |
_migrateClone | UNUSED A | internal |
createUser | UNUSED | Adds a user to the system |
getLog | UNUSED S A | { getLog : '*' } OR { getLog : 'global' } |
setFeatureCompatibilityVersion | UNUSED A | Set the API version exposed by this node. If set to "3.2", then 3.4 features are disabled. If "3.4", then 3.4 features are enabled, and all nodes in the cluster must be version 3.4. See http://dochub.mongodb.org/core/3.4-feature-compatibility. |
copydbgetnonce | UNUSED A | get a nonce for subsequent copy db request from secure server usage: {copydbgetnonce: 1, fromhost: <hostname>} |
_recvChunkStatus | UNUSED A | internal |
replSetStepUp | UNUSED S A | |
getShardMap | UNUSED S A | lists the set of shards known to this instance |
planCacheClear | UNUSED | Drops one or all cached queries in a collection. |
moveChunk | UNUSED A | should not be calling this directly |
_configsvrCommitChunkMigration | UNUSED A | should not be calling this directly |
createRole | UNUSED | Adds a role to the system |
replSetRequestVotes | UNUSED S A | |
grantRolesToRole | UNUSED | Grants roles to another role. |
resync | UNUSED S A | resync (from scratch) a stale slave or replica set secondary node. |
collMod | UNUSED | Sets collection options. Example: { collMod: 'foo', usePowerOf2Sizes:true } Example: { collMod: 'foo', index: |
saslStart | UNUSED S | First step in a SASL authentication conversation. |
getDiagnosticData | UNUSED S A | get latest diagnostic data collection snapshot |
top | UNUSED S A | usage by collection, in micros |
copydb | UNUSED A | copy a database from another host to this host usage: {copydb: 1, fromhost: <connection string>, fromdb: <db>, todb: <db>[, slaveOk: <bool>, username: <username>, nonce: <nonce>, key: <key>]} |
listCommands | UNUSED S | get a list of all db commands |
_configsvrAddShard | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Validates and adds a new shard to the cluster. |
_isSelf | UNUSED S | { _isSelf : 1 } INTERNAL ONLY |
mapreduce.shardedfinish | UNUSED S | internal |
buildInfo | UNUSED S | get version #, etc.{ buildinfo:1 } |
replSetGetStatus | UNUSED S A | Report status of a replica set from the POV of this server{ replSetGetStatus : 1 } http://dochub.mongodb.org/core/replicasetcommands |
drop | UNUSED | drop a collection{drop : <collectionName>} |
saslContinue | UNUSED S | Subsequent steps in a SASL authentication conversation. |
dropIndexes | UNUSED | drop indexes for a collection |
_recvChunkStart | UNUSED A | internal |
reIndex | UNUSED S | re-index a collection |
geoNear | UNUSED S | http://dochub.mongodb.org/core/geo |
_configsvrCommitChunkMerge | UNUSED A | Internal command, which is sent by a shard to the sharding config server. Do not call directly. Receives, validates, and processes a MergeChunkRequest |
touch | UNUSED S | touch collection Page in all pages of memory containing every extent for the given collection { touch : <collection_name>, [data : true] , [index : true] } at least one of data or index must be true; default is both are false |
profile | UNUSED S | enable or disable performance profiling{ profile : <n> } 0=off 1=log slow ops 2=log all -1 to get current values http://docs.mongodb.org/manual/reference/command/profile/ |
handshake | UNUSED S | internal |
_configsvrBalancerStatus | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Controls the balancer state. |
_recvChunkCommit | UNUSED A | internal |
splitChunk | UNUSED A | internal command usage only example: { splitChunk:"db.foo" , keyPattern: |
replSetGetRBID | UNUSED S A | |
_configsvrSetFeatureCompatibilityVersion | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Sets featureCompatibilityVersion on all shards. See http://dochub.mongodb.org/core/3.4-feature-compatibility. |
filemd5 | UNUSED S | example: { filemd5 : ObjectId(aaaaaaa) , root : "fs" } |
authenticate | UNUSED S | internal |
killCursors | UNUSED S | kill a list of cursor ids |
connectionStatus | UNUSED S | Returns connection-specific information such as logged-in users and their roles |
planCacheClearFilters | UNUSED | Clears index filter for a single query shape or, if the query shape is omitted, all filters for the collection. |
replSetSyncFrom | UNUSED S A | { replSetSyncFrom : "host:port" } Change who this member is syncing from. Note: This will interrupt and restart an in-progress initial sync. |
driverOIDTest | UNUSED S | |
unsetSharding | UNUSED S A | internal |
_transferMods | UNUSED A | internal |
getCmdLineOpts | UNUSED S A | get argv |
_getUserCacheGeneration | UNUSED S A | internal |
convertToCapped | UNUSED | { convertToCapped:<fromCollectionName>, size:<sizeInBytes> } |
planCacheListQueryShapes | UNUSED | Displays all query shapes in a collection. |
_mergeAuthzCollections | UNUSED A | Internal command used by mongorestore for updating user/role data |
count | UNUSED | count objects in collection |
listIndexes | UNUSED | list indexes for a collection |
getParameter | UNUSED S A | get administrative option(s) example: { getParameter:1, notablescan:1 } supported: ShardingTaskExecutorPoolHostTimeoutMS ShardingTaskExecutorPoolMaxSize ShardingTaskExecutorPoolMinSize ShardingTaskExecutorPoolRefreshRequirementMS ShardingTaskExecutorPoolRefreshTimeoutMS authSchemaVersion authenticationMechanisms automationServiceDescriptor clientCursorMonitorFrequencySecs clusterAuthMode connPoolMaxConnsPerHost connPoolMaxShardedConnsPerHost cursorTimeoutMillis diagnosticDataCollectionDirectorySizeMB diagnosticDataCollectionEnabled diagnosticDataCollectionFileSizeMB diagnosticDataCollectionPeriodMillis diagnosticDataCollectionSamplesPerChunk diagnosticDataCollectionSamplesPerInterimUpdate disableJavaScriptJIT enableLocalhostAuthBypass enableReplSnapshotThread enableTestCommands failIndexKeyTooLong featureCompatibilityVersion heapProfilingEnabled heapProfilingSampleIntervalBytes initialSyncOplogBuffer initialSyncOplogBufferPeekCacheSize internalDocumentSourceCursorBatchSizeBytes internalGeoNearQuery2DMaxCoveringCells internalGeoPredicateQuery2DMaxCoveringCells internalInsertMaxBatchSize internalQueryCacheEvictionRatio internalQueryCacheFeedbacksStored internalQueryCacheSize internalQueryEnumerationMaxIntersectPerAnd internalQueryEnumerationMaxOrSolutions internalQueryExecMaxBlockingSortBytes internalQueryExecYieldIterations internalQueryExecYieldPeriodMS internalQueryFacetBufferSizeBytes internalQueryForceIntersectionPlans internalQueryMaxScansToExplode internalQueryPlanEvaluationCollFraction internalQueryPlanEvaluationMaxResults internalQueryPlanEvaluationWorks internalQueryPlanOrChildrenIndependently internalQueryPlannerEnableHashIntersection internalQueryPlannerEnableIndexIntersection internalQueryPlannerMaxIndexedSolutions internalQueryS2GeoCoarsestLevel internalQueryS2GeoFinestLevel internalQueryS2GeoMaxCells internalValidateFeaturesAsMaster javascriptProtection journalCommitInterval jsHeapLimitMB logComponentVerbosity logLevel logUserIds maxIndexBuildMemoryUsageMegabytes maxLogSizeKB maxSyncSourceLagSecs messagePortImpl newCollectionsUsePowerOf2Sizes notablescan num3Dot2InitialSyncAttempts numInitialSyncAttempts numInitialSyncCollectionCountAttempts numInitialSyncCollectionFindAttempts numInitialSyncConnectAttempts numInitialSyncListCollectionsAttempts numInitialSyncListDatabasesAttempts numInitialSyncListIndexesAttempts numInitialSyncOplogFindAttempts oplogFetcherMaxFetcherRestarts priorityTakeoverFreshnessWindowSeconds quiet replApplyBatchSize replBatchLimitOperations replElectionTimeoutOffsetLimitFraction replIndexPrefetch replSnapshotThreadThrottleMicros replWriterThreadCount saslHostName saslServiceName saslauthdPath scramIterationCount scriptingEngineInterruptIntervalMS skipCorruptDocumentsWhenCloning sslMode startupAuthSchemaValidation syncdelay taskExecutorPoolSize tcmallocAggressiveMemoryDecommit tcmallocMaxTotalThreadCacheBytes testingSnapshotBehaviorInIsolation traceExceptions traceWriteConflictExceptions ttlMonitorEnabled ttlMonitorSleepSecs use3dot2InitialSync wiredTigerConcurrentReadTransactions wiredTigerConcurrentWriteTransactions wiredTigerEngineRuntimeConfig writePeriodicNoops { getParameter:'*' } to get everything |
distinct | UNUSED | { distinct : 'collection name' , key : 'a.b' , query : |
find | UNUSED | query for documents |
setParameter | UNUSED S A | set administrative option(s){ setParameter:1, <param>:<value> } supported: ShardingTaskExecutorPoolHostTimeoutMS ShardingTaskExecutorPoolMaxSize ShardingTaskExecutorPoolMinSize ShardingTaskExecutorPoolRefreshRequirementMS ShardingTaskExecutorPoolRefreshTimeoutMS authSchemaVersion authenticationMechanisms automationServiceDescriptor clientCursorMonitorFrequencySecs clusterAuthMode connPoolMaxConnsPerHost connPoolMaxShardedConnsPerHost cursorTimeoutMillis diagnosticDataCollectionDirectorySizeMB diagnosticDataCollectionEnabled diagnosticDataCollectionFileSizeMB diagnosticDataCollectionPeriodMillis diagnosticDataCollectionSamplesPerChunk diagnosticDataCollectionSamplesPerInterimUpdate disableJavaScriptJIT enableLocalhostAuthBypass enableReplSnapshotThread enableTestCommands failIndexKeyTooLong featureCompatibilityVersion heapProfilingEnabled heapProfilingSampleIntervalBytes initialSyncOplogBuffer initialSyncOplogBufferPeekCacheSize internalDocumentSourceCursorBatchSizeBytes internalGeoNearQuery2DMaxCoveringCells internalGeoPredicateQuery2DMaxCoveringCells internalInsertMaxBatchSize internalQueryCacheEvictionRatio internalQueryCacheFeedbacksStored internalQueryCacheSize internalQueryEnumerationMaxIntersectPerAnd internalQueryEnumerationMaxOrSolutions internalQueryExecMaxBlockingSortBytes internalQueryExecYieldIterations internalQueryExecYieldPeriodMS internalQueryFacetBufferSizeBytes internalQueryForceIntersectionPlans internalQueryMaxScansToExplode internalQueryPlanEvaluationCollFraction internalQueryPlanEvaluationMaxResults internalQueryPlanEvaluationWorks internalQueryPlanOrChildrenIndependently internalQueryPlannerEnableHashIntersection internalQueryPlannerEnableIndexIntersection internalQueryPlannerMaxIndexedSolutions internalQueryS2GeoCoarsestLevel internalQueryS2GeoFinestLevel internalQueryS2GeoMaxCells internalValidateFeaturesAsMaster javascriptProtection journalCommitInterval jsHeapLimitMB logComponentVerbosity logLevel logUserIds maxIndexBuildMemoryUsageMegabytes maxLogSizeKB maxSyncSourceLagSecs messagePortImpl newCollectionsUsePowerOf2Sizes notablescan num3Dot2InitialSyncAttempts numInitialSyncAttempts numInitialSyncCollectionCountAttempts numInitialSyncCollectionFindAttempts numInitialSyncConnectAttempts numInitialSyncListCollectionsAttempts numInitialSyncListDatabasesAttempts numInitialSyncListIndexesAttempts numInitialSyncOplogFindAttempts oplogFetcherMaxFetcherRestarts priorityTakeoverFreshnessWindowSeconds quiet replApplyBatchSize replBatchLimitOperations replElectionTimeoutOffsetLimitFraction replIndexPrefetch replSnapshotThreadThrottleMicros replWriterThreadCount saslHostName saslServiceName saslauthdPath scramIterationCount scriptingEngineInterruptIntervalMS skipCorruptDocumentsWhenCloning sslMode startupAuthSchemaValidation syncdelay taskExecutorPoolSize tcmallocAggressiveMemoryDecommit tcmallocMaxTotalThreadCacheBytes testingSnapshotBehaviorInIsolation traceExceptions traceWriteConflictExceptions ttlMonitorEnabled ttlMonitorSleepSecs use3dot2InitialSync wiredTigerConcurrentReadTransactions wiredTigerConcurrentWriteTransactions wiredTigerEngineRuntimeConfig writePeriodicNoops |
repairDatabase | UNUSED S | repair database. also compacts. note: slow. |
features | UNUSED S | return build level feature settings |
_configsvrCommitChunkSplit | UNUSED A | Internal command, which is sent by a shard to the sharding config server. Do not call directly. Receives, validates, and processes a SplitChunkRequest. |
currentOp | UNUSED S A | |
listCollections | UNUSED | list collections for this db |
shardConnPoolStats | UNUSED S | stats about the shard connection pool |
grantRolesToUser | UNUSED | Grants roles to a user. |
revokeRolesFromRole | UNUSED | Revokes roles from another role. |
_configsvrAddShardToZone | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Validates and adds a new zone to the shard. |
fsyncUnlock | UNUSED S A | |
replSetHeartbeat | UNUSED S A | |
lockInfo | UNUSED S A | show all lock info on the server |
renameCollection | UNUSED A | example: { renameCollection: foo.a, to: bar.b } |
clone | UNUSED | clone this database from an instance of the db on another host{clone: "host13"[, slaveOk: <bool>]} |
replSetFreeze | UNUSED S A | { replSetFreeze : <seconds> } 'freeze' state of member to the extent we can do that. What this really means is thatthis node will not attempt to become primary until the time period specified expires. You can call again with {replSetFreeze:0} to unfreeze sooner.A process restart unfreezes the member also. http://dochub.mongodb.org/core/replicasetcommands |
dropAllUsersFromDatabase | UNUSED | Drops all users for a single database. |
appendOplogNote | UNUSED A | Adds a no-op entry to the oplog |
applyOps | UNUSED | internal (sharding){ applyOps : [ ] , preCondition : [ |
splitVector | UNUSED | Internal command. examples: { splitVector : "blog.post" , keyPattern: maxChunkSize unit in MBs May optionally specify 'maxSplitPoints' and 'maxChunkObjects' to avoid traversing the whole chunk { splitVector : "blog.post" , keyPattern: 'force' will produce one split point even if data is small; defaults to false NOTE: This command may take a while to run |
updateRole | UNUSED | Used to update a role |
replSetReconfig | UNUSED S A | Adjust configuration of a replica set{ replSetReconfig : config_object } http://dochub.mongodb.org/core/replicasetcommands |
_configsvrBalancerStart | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Controls the balancer state. |
_configsvrUpdateZoneKeyRange | UNUSED A | Internal command, which is exported by the sharding config server. Do not call directly. Validates and assigns a new range to a zone. |
replSetUpdatePosition | UNUSED S A | |
hostInfo | UNUSED S | returns information about the daemon's host |
diagLogging | UNUSED S A | http://dochub.mongodb.org/core/monitoring |
replSetFresh | UNUSED S A | |
explain | UNUSED | explain database reads and writes |
mapReduce | UNUSED S | Run a map/reduce operation on the server. Note this is used for aggregation, not querying, in MongoDB. http://dochub.mongodb.org/core/mapreduce |
aggregate | UNUSED | { pipeline: [ See http://dochub.mongodb.org/core/aggregation for more details. |
copydbsaslstart | UNUSED A | Initialize a SASL auth session for subsequent copy db request from secure server |
replSetGetConfig | UNUSED S A | Returns the current replica set configuration{ replSetGetConfig : 1 } http://dochub.mongodb.org/core/replicasetcommands |
create | UNUSED | create a collection explicitly{ create: <ns>[, capped: <bool>, size: <collSizeInBytes>, max: <nDocs>] } |
cloneCollection | UNUSED | { cloneCollection: <collection>, from: <host> [,query: <query_filter>] [,copyIndexes:<bool>] } Copies a collection from one server to another. Do not use on a single server as the destination is placed at the same db.collection (namespace) as the source. |
getLastError | UNUSED S | return error status of the last operation on this connection options: { fsync:true } - fsync before returning, or wait for journal commit if running with --journal{ j:true } - wait for journal commit if running with --journal{ w:n } - await replication to n servers (including self) before returning{ w:'majority' } - await replication to majority of set{ wtimeout:m} - timeout for w in m milliseconds |
repairCursor | UNUSED S | |
planCacheListFilters | UNUSED | Displays index filters for all query shapes in a collection. |
currentOpCtx | UNUSED S | |
eval | UNUSED | DEPRECATED Evaluate javascript at the server. http://dochub.mongodb.org/core/serversidecodeexecution |
replSetElect | UNUSED S A | |
dataSize | UNUSED S | determine data size for a set of data in a certain range example: { dataSize:"blog.posts", keyPattern: min and max parameters are optional. They must either both be included or both omitted keyPattern is an optional parameter indicating an index pattern that would be usefulfor iterating over the min/max bounds. If keyPattern is omitted, it is inferred from the structure of min. note: This command may take a while to run |