MongoDB compatibility and feature support with Azure Cosmos DB for MongoDB vCore
APPLIES TO: MongoDB vCore
Azure Cosmos DB for MongoDB vCore allows you to experience the familiar MongoDB advantages while accessing the enhanced enterprise features offered by Azure Cosmos DB. It ensures compatibility by following the MongoDB wire protocol, allowing you to leverage existing client drivers, SDKs and other tools you're already familiar with.
Protocol support
The supported operators and any limitations or exceptions are listed here. Any client driver that understands these protocols should be able to connect to Azure Cosmos DB for MongoDB. When you create Azure Cosmos DB for MongoDB vCore clusters, the endpoint is in the format *.mongocluster.cosmos.azure.cn
.
Query language support
Azure Cosmos DB for MongoDB provides comprehensive support for MongoDB query language constructs. Below you can find the detailed list of currently supported database commands, operators, stages, and options.
Note
This article only lists the supported server commands, and excludes client-side wrapper functions. Client-side wrapper functions such as deleteMany()
and updateMany()
internally utilize the delete()
and update()
server commands. Functions utilizing supported server commands are compatible with the Azure Cosmos DB for MongoDB.
Database commands
Azure Cosmos DB for MongoDB vCore supports the following database commands:
Category | Command | Feature | ||
v5.0 | v6.0 | v7.0 | ||
Aggregation Commands | aggregate | |||
count | ||||
distinct | ||||
mapReduce | Deprecated in MongoDB 5.0 | |||
Authentication Commands | authenticate | |||
getnonce | Deprecated in MongoDB 4.0 | |||
logout | Deprecated in MongoDB 5.0 | |||
Geospatial Commands | geoSearch | Deprecated in MongoDB 5.0 | ||
Query Plan Cache Commands | ||||
Administrative Commands | cloneCollectionAsCapped | No, capped collections are currently not supported. | ||
collMod | ||||
compact | ||||
convertToCapped | No. Capped collections are currently not supported. | |||
create | ||||
createIndexes | ||||
currentOp | ||||
drop | ||||
dropDatabase | ||||
dropConnections | As a PaaS service, this will be managed by Azure. | |||
dropIndexes | ||||
filemd5 | ||||
fsync | As a PaaS service, this will be managed by Azure. | |||
fsyncUnlock | As a PaaS service, this will be managed by Azure. | |||
getDefaultRWConcern | ||||
getClusterParameter | ||||
getParameter | ||||
killCursors | ||||
killOp | ||||
listCollections | ||||
listDatabases | ||||
listIndexes | ||||
logRotate | As a PaaS service, this will be managed by Azure. | |||
reIndex | ||||
renameCollection | ||||
rotateCertificates | As a PaaS service, this will be managed by Azure. | |||
setFeatureCompatibilityVersion | As a PaaS service, this will be managed by Azure. | |||
setIndexCommitQuorum | ||||
setParameter | ||||
setDefaultRWConcern | ||||
shutdown | As a PaaS service, this will be managed by Azure. | |||
User & Role Management Commands | Not supported today, but will be made available through Azure Active Directory in the future. | |||
Replication Commands | Azure manages replication, removing the necessity for customers to replicate manually. | |||
Sharding Commands | enableSharding | |||
isdbgrid | ||||
reshardCollection | ||||
shardCollection | ||||
unsetSharding | Deprecated in MongoDB 5.0 | |||
addShard | As a Platform-as-a-Service (PaaS) offering, Azure manages shard management and rebalancing. Users only need to specify the sharding strategy for the collections and Azure will handle the rest. | |||
addShardToZone | ||||
clearJumboFlag | ||||
cleanupOrphaned | ||||
removeShard | ||||
removeShardFromZone | ||||
setShardVersion | ||||
mergeChunks | ||||
checkShardingIndex | ||||
getShardMap | ||||
getShardVersion | ||||
medianKey | ||||
splitVector | ||||
shardingState | ||||
cleanupReshardCollection | ||||
flushRouterConfig | ||||
balancerCollectionStatus | ||||
balancerStart | ||||
balancerStatus | ||||
balancerStop | ||||
configureCollectionBalancing | ||||
listShards | ||||
split | ||||
moveChunk | ||||
updateZoneKeyRange | ||||
movePrimary | ||||
abortReshardCollection | ||||
commitReshardCollection | ||||
refineCollectionShardKey | ||||
Query and Write Operation Commands | change streams | |||
delete | ||||
find | ||||
findAndModify | ||||
getLastError | Deprecated in MongoDB 5.1 | |||
getMore | ||||
insert | ||||
resetError | Deprecated in MongoDB 5.0 | |||
update | ||||
Session Commands | abortTransaction | |||
commitTransaction | ||||
endSessions | ||||
killAllSessions | ||||
killAllSessionsByPattern | ||||
killSessions | ||||
refreshSessions | ||||
startSession | ||||
Diagnostic Commands | availableQueryOptions | |||
buildInfo | ||||
collStats | ||||
connPoolStats | ||||
connectionStatus | ||||
dataSize | ||||
dbHash | ||||
dbStats | ||||
driverOIDTest | As a PaaS service, this will be managed by Azure. | |||
explain | ||||
features | As a PaaS service, this will be managed by Azure. | |||
getCmdLineOpts | ||||
getLog | ||||
hostInfo | ||||
_isSelf | ||||
listCommands | ||||
lockInfo | ||||
netstat | ||||
ping | ||||
profile | As a PaaS service, this will be managed by Azure. | |||
serverStatus | ||||
shardConnPoolStats | Deprecated in MongoDB 5.0 | |||
top | ||||
validate | ||||
whatsmyuri | ||||
System Events Auditing Commands | logApplicationMessage |
Operators
Below are the list of operators currently supported on Azure Cosmos DB for MongoDB vCore:
Note
The $lookup
aggregation does not yet support using variable expressions using 'let'.
AvgObjsize and size in "collStats" & "dbStats" works with document size less than 2KB only.
Category | Command | Feature | ||
v5.0 | v6.0 | v7.0 | ||
Comparison Query Operators | $eq | |||
$gt | ||||
$gte | ||||
$in | ||||
$lt | ||||
$lte | ||||
$ne | ||||
$nin | ||||
Logical Query Operators | $and | |||
$not | ||||
$nor | ||||
$or | ||||
Element Query Operators | $exists | |||
$type | ||||
Evaluation Query Operators | $expr | |||
$jsonSchema | ||||
$mod | ||||
$regex | ||||
$text | ||||
$where | ||||
Geospatial Operators | $geoIntersects | |||
$geoWithin | ||||
$box | ||||
$center | ||||
$centerSphere | ||||
$geometry | ||||
$maxDistance | ||||
$minDistance | ||||
$polygon | ||||
$near | ||||
$nearSphere | ||||
Array Query Operators | $all | |||
$elemMatch | ||||
$size | ||||
Bitwise Query Operators | $bitsAllClear | |||
$bitsAllSet | ||||
$bitsAnyClear | ||||
$bitsAnySet | ||||
Projection Operators | $ | |||
$elemMatch | ||||
$meta | ||||
$slice | ||||
Miscellaneous Query Operators | $comment | |||
$rand | ||||
$natural | ||||
Field Update Operators | $currentDate | |||
$inc | ||||
$min | ||||
$max | ||||
$mul | ||||
$rename | ||||
$set | ||||
$setOnInsert | ||||
$unset | ||||
Array Update Operators | $ | |||
$[] | ||||
$[identifier] | ||||
$addToSet | ||||
$pop | ||||
$pull | ||||
$push | ||||
$pullAll | ||||
$each | ||||
$position | ||||
$slice | ||||
$sort | ||||
Bitwise Update Operators | $bit | |||
Arithmetic Expression Operators | $abs | |||
$add | ||||
$ceil | ||||
$divide | ||||
$exp | ||||
$floor | ||||
$ln | ||||
$log | ||||
$log10 | ||||
$mod | ||||
$multiply | ||||
$pow | ||||
$round | ||||
$sqrt | ||||
$subtract | ||||
$trunc | ||||
Array Expression Operators | $arrayElemAt | |||
$arrayToObject | ||||
$concatArrays | ||||
$filter | ||||
$firstN | ||||
$in | ||||
$indexOfArray | ||||
$isArray | ||||
$lastN | ||||
$map | ||||
$maxN | ||||
$minN | ||||
$objectToArray | ||||
$range | ||||
$reduce | ||||
$reverseArray | ||||
$size | ||||
$slice | ||||
$sortArray | ||||
$zip | ||||
Bitwise Operators | $bitAnd | |||
$bitNot | ||||
$bitOr | ||||
$bitXor | ||||
Boolean Expression Operators | $and | |||
$not | ||||
$or | ||||
Comparison Expression Operators | $cmp | |||
$eq | ||||
$gt | ||||
$gte | ||||
$lt | ||||
$lte | ||||
$ne | ||||
Custom Aggregation Expression Operators | Not supported yet. | |||
Data Size Operators | $bsonSize | |||
$binarySize | ||||
Date Expression Operators | $dateAdd | |||
$dateDiff | ||||
$dateFromParts | ||||
$dateFromString | ||||
$dateSubtract | ||||
$dateToParts | ||||
$dateToString | ||||
$dateTrunc | ||||
$dayOfMonth | ||||
$dayOfWeek | ||||
$dayOfYear | ||||
$hour | ||||
$isoDayOfWeek | ||||
$isoWeek | ||||
$isoWeekYear | ||||
$millisecond | ||||
$minute | ||||
$month | ||||
$second | ||||
$toDate | ||||
$week | ||||
$year | ||||
Literal Expression Operator | $literal | |||
Miscellaneous Operators | $getField | |||
$rand | ||||
$sampleRate | ||||
Object Expression Operators | $mergeObjects | |||
$objectToArray | ||||
$setField | ||||
Set Expression Operators | $allElementsTrue | |||
$anyElementTrue | ||||
$setDifference | ||||
$setEquals | ||||
$setIntersection | ||||
$setIsSubset | ||||
$setUnion | ||||
String Expression Operators | $concat | |||
$dateFromString | ||||
$dateToString | ||||
$indexOfBytes | ||||
$indexOfCP | ||||
$ltrim | ||||
$regexFind | ||||
$regexFindAll | ||||
$regexMatch | ||||
$replaceOne | ||||
$replaceAll | ||||
$rtrim | ||||
$split | ||||
$strLenBytes | ||||
$strLenCP | ||||
$strcasecmp | ||||
$substr | ||||
$substrBytes | ||||
$substrCP | ||||
$toLower | ||||
$toString | ||||
$trim | ||||
$toUpper | ||||
Text Expression Operator | $meta | |||
Timestamp Expression Operators | $tsIncrement | |||
$tsSecond | ||||
Trigonometry Expression Operators | Not supported yet. | |||
Type Expression Operators | $convert | |||
$isNumber | ||||
$toBool | ||||
$toDate | ||||
$toDecimal | ||||
$toDouble | ||||
$toInt | ||||
$toLong | ||||
$toObjectId | ||||
$toString | ||||
$type | ||||
Accumulators ($group, $bucket, $bucketAuto, $setWindowFields) | $accumulator | |||
$addToSet | ||||
$avg | ||||
$bottom | ||||
$bottomN | ||||
$count | ||||
$first | ||||
$firstN | ||||
$last | ||||
$lastN | ||||
$max | ||||
$maxN | ||||
$median | ||||
$mergeObjects | ||||
$min | ||||
$percentile | ||||
$push | ||||
$stdDevPop | ||||
$stdDevSamp | ||||
$sum | ||||
$top | ||||
$topN | ||||
Accumulators (in Other Stages) | $avg | |||
$first | ||||
$last | ||||
$max | ||||
$median | ||||
$min | ||||
$percentile | ||||
$stdDevPop | ||||
$stdDevSamp | ||||
$sum | ||||
Variable Expression Operators | Not supported yet. | |||
Window Operators | Not supported yet. | |||
Conditional Expression Operators | $cond | |||
$ifNull | ||||
$switch | ||||
Aggregation Pipeline Stages | $addFields | |||
$bucket | ||||
$bucketAuto | ||||
$changeStream | ||||
$changeStreamSplitLargeEvent | ||||
$collStats | ||||
$count | ||||
$densify | ||||
$documents | ||||
$facet | ||||
$fill | ||||
$geoNear | ||||
$graphLookup | ||||
$group | ||||
$indexStats | ||||
$limit | ||||
$listSampledQueries | ||||
$listSearchIndexes | ||||
$listSessions | ||||
$lookup | ||||
$match | ||||
$merge | ||||
$out | ||||
$planCacheStats | ||||
$project | ||||
$redact | ||||
$replaceRoot | ||||
$replaceWith | ||||
$sample | ||||
$search | ||||
$searchMeta | ||||
$set | ||||
$setWindowFields | ||||
$skip | ||||
$sort | ||||
$sortByCount | ||||
$unionWith | ||||
$unset | ||||
$unwind | ||||
$shardedDataDistribution | ||||
$changeStream | ||||
$currentOp | ||||
$listLocalSessions | ||||
$documents | ||||
Variables in Aggregation Expressions | NOW | |||
ROOT | ||||
REMOVE | ||||
CURRENT | ||||
CLUSTER_TIME | ||||
DESCEND | ||||
PRUNE | ||||
KEEP | ||||
SEARCH_META | ||||
USER_ROLES |
Indexes and index properties
Azure Cosmos DB for MongoDB vCore supports the following indexes and index properties:
Note
Creating a unique index obtains an exclusive lock on the collection for the entire duration of the build process. This blocks read and write operations on the collection until the operation is completed.
Indexes
Command | Supported |
Single Field Index | |
Compound Index | |
Multikey Index | |
Text Index | |
Wildcard Index | |
Geospatial Index | |
Hashed Index |
Index properties
Command | Supported |
TTL | |
Unique | |
Partial | |
Case Insensitive | |
Sparse | |
Background |