Skip to main content

Execute Database Commands

POST 

/commands

Execute MongoDB-style database commands in batch. All commands are executed sequentially and return a corresponding result array. Supports transaction execution.

Only administrators and CloudBase OpenAPI can invoke this endpoint.

Common commands include: find, insert, update, delete, aggregate, createIndexes, etc.

Unsupported Commands

The following commands are no longer supported and return an error when invoked:

Unsupported CommandAlternative
groupUse the $group stage of aggregate
geoNearUse the $geoNear stage of aggregate
evalRun the logic in the application layer
copydb, cloneRead data with find, then write to the target collection with insert
cloneCollectionDeprecated; use find + insert instead
repairDatabaseNo alternative; contact technical support to rebuild indexes
getPrevErrorNo alternative
parallelCollectionScanNo alternative

In addition, the find command no longer supports the maxScan option. Use maxTimeMS instead.

Request​

Responses​

Commands executed successfully