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:

CategoryCommandFeature
v5.0v6.0v7.0
Aggregation CommandsaggregateYesYesYes
countYesYesYes
distinctYesYesYes
mapReduceDeprecated in MongoDB 5.0
Authentication CommandsauthenticateYesYesYes
getnonceDeprecated in MongoDB 4.0
logoutDeprecated in MongoDB 5.0
Geospatial CommandsgeoSearchDeprecated in MongoDB 5.0
Query Plan Cache CommandsNoNoNo
Administrative CommandscloneCollectionAsCappedNoNo, capped collections are currently not supported.
collModYesYesYes
compactNoNoNo
convertToCappedNoNo. Capped collections are currently not supported.
createYesYesYes
createIndexesYesYesYes
currentOpYesYesYes
dropYesYesYes
dropDatabaseYesYesYes
dropConnectionsAs a PaaS service, this will be managed by Azure.
dropIndexesYesYesYes
filemd5NoNoNo
fsyncAs a PaaS service, this will be managed by Azure.
fsyncUnlockAs a PaaS service, this will be managed by Azure.
getDefaultRWConcernYesYesYes
getClusterParameterNoNo
getParameterYesYesYes
killCursorsYesYesYes
killOpYesYesYes
listCollectionsYesYesYes
listDatabasesYesYesYes
listIndexesYesYesYes
logRotateAs a PaaS service, this will be managed by Azure.
reIndexYesYesYes
renameCollectionYesYesYes
rotateCertificatesAs a PaaS service, this will be managed by Azure.
setFeatureCompatibilityVersionAs a PaaS service, this will be managed by Azure.
setIndexCommitQuorumNoNoNo
setParameterYesYesYes
setDefaultRWConcernNoNoNo
shutdownAs a PaaS service, this will be managed by Azure.
User & Role Management CommandsNot supported today, but will be made available through Azure Active Directory in the future.
Replication CommandsAzure manages replication, removing the necessity for customers to replicate manually.
Sharding CommandsenableShardingYesYesYes
isdbgridYesYesYes
reshardCollectionYesYesYes
shardCollectionYesYesYes
unsetShardingDeprecated in MongoDB 5.0
addShardAs 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 Commandschange streamsNoNoNo
deleteYesYesYes
findYesYesYes
findAndModifyYesYesYes
getLastErrorDeprecated in MongoDB 5.1
getMoreYesYesYes
insertYesYesYes
resetErrorDeprecated in MongoDB 5.0
updateYesYesYes
Session CommandsabortTransactionYesYesYes
commitTransactionYesYesYes
endSessionsYesYesYes
killAllSessionsNoNoNo
killAllSessionsByPatternNoNoNo
killSessionsYesYesYes
refreshSessionsNoNoNo
startSessionYesYesYes
Diagnostic CommandsavailableQueryOptionsNoNoNo
buildInfoYesYesYes
collStatsYesYesYes
connPoolStatsNoNoNo
connectionStatusYesYesYes
dataSizeNoNoNo
dbHashNoNoNo
dbStatsYesYesYes
driverOIDTestAs a PaaS service, this will be managed by Azure.
explainYesYesYes
featuresAs a PaaS service, this will be managed by Azure.
getCmdLineOptsYesYesYes
getLogYesYesYes
helloYesYesYes
hostInfoYesYesYes
_isSelfNoNoNo
listCommandsYesYesYes
lockInfoNoNoNo
netstatNoNoNo
pingYesYesYes
profileAs a PaaS service, this will be managed by Azure.
serverStatusNoNoNo
shardConnPoolStatsDeprecated in MongoDB 5.0
topNoNoNo
validateYesYesYes
whatsmyuriYesYesYes
System Events Auditing CommandslogApplicationMessageNoNoNo

Operators

Below are the list of operators currently supported on Azure Cosmos DB for MongoDB vCore:

Note

AvgObjsize and size in "collStats" & "dbStats" works with document size less than 2KB only.

CategoryCommandFeature
v5.0v6.0v7.0
Comparison Query Operators$eqYesYesYes
$gtYesYesYes
$gteYesYesYes
$inYesYesYes
$ltYesYesYes
$lteYesYesYes
$neYesYesYes
$ninYesYesYes
Logical Query Operators$andYesYesYes
$notYesYesYes
$norYesYesYes
$orYesYesYes
Element Query Operators$existsYesYesYes
$typeYesYesYes
Evaluation Query Operators$exprYesYesYes
$jsonSchemaNoNoNo
$modYesYesYes
$regexYesYesYes
$textYesYesYes
$whereNoNoNo
Geospatial Operators$geoIntersectsYesYesYes
$geoWithinYesYesYes
$boxYesYesYes
$centerYesYesYes
$centerSphereYesYesYes
$geometryYesYesYes
$maxDistanceYesYesYes
$minDistanceYesYesYes
$polygonYesYesYes
$nearYesYesYes
$nearSphereYesYesYes
Array Query Operators$allYesYesYes
$elemMatchYesYesYes
$sizeYesYesYes
Bitwise Query Operators$bitsAllClearYesYesYes
$bitsAllSetYesYesYes
$bitsAnyClearYesYesYes
$bitsAnySetYesYesYes
Projection Operators$YesYesYes
$elemMatchYesYesYes
$metaYesYesYes
$sliceYesYesYes
Miscellaneous Query Operators$commentNoNoNo
$randYesYesYes
$naturalNoNoNo
Field Update Operators$currentDateYesYesYes
$incYesYesYes
$minYesYesYes
$maxYesYesYes
$mulYesYesYes
$renameYesYesYes
$setYesYesYes
$setOnInsertYesYesYes
$unsetYesYesYes
Array Update Operators$YesYesYes
$[]YesYesYes
$[identifier]YesYesYes
$addToSetYesYesYes
$popYesYesYes
$pullYesYesYes
$pushYesYesYes
$pullAllYesYesYes
$eachYesYesYes
$positionYesYesYes
$sliceYesYesYes
$sortYesYesYes
Bitwise Update Operators$bitYesYesYes
Arithmetic Expression Operators$absYesYesYes
$addYesYesYes
$ceilYesYesYes
$divideYesYesYes
$expYesYesYes
$floorYesYesYes
$lnYesYesYes
$logYesYesYes
$log10YesYesYes
$modYesYesYes
$multiplyYesYesYes
$powYesYesYes
$roundYesYesYes
$sqrtYesYesYes
$subtractYesYesYes
$truncYesYesYes
Array Expression Operators$arrayElemAtYesYesYes
$arrayToObjectYesYesYes
$concatArraysYesYesYes
$filterYesYesYes
$firstNYesYesYes
$inYesYesYes
$indexOfArrayYesYesYes
$isArrayYesYesYes
$lastNYesYesYes
$mapYesYesYes
$maxNYesYes
$minNYesYes
$objectToArrayYesYesYes
$rangeYesYesYes
$reduceYesYesYes
$reverseArrayYesYesYes
$sizeYesYesYes
$sliceYesYesYes
$sortArrayYesYes
$zipYesYesYes
Bitwise Operators$bitAndYesYesYes
$bitNotYesYesYes
$bitOrYesYesYes
$bitXorYesYesYes
Boolean Expression Operators$andYesYesYes
$notYesYesYes
$orYesYesYes
Comparison Expression Operators$cmpYesYesYes
$eqYesYesYes
$gtYesYesYes
$gteYesYesYes
$ltYesYesYes
$lteYesYesYes
$neYesYesYes
Custom Aggregation Expression OperatorsNot supported yet.
Data Size Operators$bsonSizeYesYesYes
$binarySizeYesYesYes
Date Expression Operators$dateAddYesYesYes
$dateDiffYesYesYes
$dateFromPartsYesYesYes
$dateFromStringYesYesYes
$dateSubtractYesYesYes
$dateToPartsYesYesYes
$dateToStringYesYesYes
$dateTruncYesYesYes
$dayOfMonthYesYesYes
$dayOfWeekYesYesYes
$dayOfYearYesYesYes
$hourYesYesYes
$isoDayOfWeekYesYesYes
$isoWeekYesYesYes
$isoWeekYearYesYesYes
$millisecondYesYesYes
$minuteYesYesYes
$monthYesYesYes
$secondYesYesYes
$toDateYesYesYes
$weekYesYesYes
$yearYesYesYes
Literal Expression Operator$literalYesYesYes
Miscellaneous Operators$getFieldYesYesYes
$randYesYesYes
$sampleRateYesYesYes
Object Expression Operators$mergeObjectsYesYesYes
$objectToArrayYesYesYes
$setFieldYesYesYes
Set Expression Operators$allElementsTrueYesYesYes
$anyElementTrueYesYesYes
$setDifferenceYesYesYes
$setEqualsYesYesYes
$setIntersectionYesYesYes
$setIsSubsetYesYesYes
$setUnionYesYesYes
String Expression Operators$concatYesYesYes
$dateFromStringYesYesYes
$dateToStringYesYesYes
$indexOfBytesYesYesYes
$indexOfCPYesYesYes
$ltrimYesYesYes
$regexFindYesYesYes
$regexFindAllYesYesYes
$regexMatchYesYesYes
$replaceOneYesYesYes
$replaceAllYesYesYes
$rtrimYesYesYes
$splitYesYesYes
$strLenBytesYesYesYes
$strLenCPYesYesYes
$strcasecmpYesYesYes
$substrYesYesYes
$substrBytesYesYesYes
$substrCPYesYesYes
$toLowerYesYesYes
$toStringYesYesYes
$trimYesYesYes
$toUpperYesYesYes
Text Expression Operator$metaYesYesYes
Timestamp Expression Operators$tsIncrementYesYesYes
$tsSecondYesYesYes
Trigonometry Expression Operators$sinYesYesYes
$cosYesYesYes
$tanYesYesYes
$asinYesYesYes
$acosYesYesYes
$atanYesYesYes
$atan2YesYesYes
$asinhYesYesYes
$acoshYesYesYes
$atanhYesYesYes
$sinhYesYesYes
$coshYesYesYes
$tanhYesYesYes
$degreesToRadiansYesYesYes
$radiansToDegreesYesYesYes
Type Expression Operators$convertYesYesYes
$isNumberYesYesYes
$toBoolYesYesYes
$toDateYesYesYes
$toDecimalYesYesYes
$toDoubleYesYesYes
$toIntYesYesYes
$toLongYesYesYes
$toObjectIdYesYesYes
$toStringYesYesYes
$typeYesYesYes
Accumulators ($group, $bucket, $bucketAuto, $setWindowFields)$accumulatorNoNoNo
$addToSetYesYesYes
$avgYesYesYes
$bottomYesYes
$bottomNYesYes
$countYesYesYes
$firstYesYesYes
$firstNYesYesYes
$lastYesYesYes
$lastNYesYesYes
$maxYesYesYes
$maxNYesYes
$medianNoNoNo
$mergeObjectsYesYesYes
$minYesYesYes
$percentileNoNoNo
$pushYesYesYes
$stdDevPopYesYesYes
$stdDevSampYesYesYes
$sumYesYesYes
$topYesYes
$topNYesYes
Accumulators (in Other Stages)$avgYesYesYes
$firstYesYesYes
$lastYesYesYes
$maxYesYesYes
$medianNoNoNo
$minYesYesYes
$percentileNoNoNo
$stdDevPopYesYesYes
$stdDevSampYesYesYes
$sumYesYesYes
Variable Expression Operators$letYesYesYes
Window Operators$sumYesYesYes
$pushYesYesYes
$addToSetYesYesYes
$countYesYesYes
$maxYesYesYes
$minYesYesYes
$avgYesYesYes
$stdDevPopYesYesYes
$bottomYesYesYes
$bottomNYesYesYes
$covariancePopYesYesYes
$covarianceSampYesYesYes
$denseRankYesYesYes
$derivativeYesYesYes
$documentNumberYesYesYes
$expMovingAvgYesYesYes
$firstYesYesYes
$integralYesYesYes
$lastYesYesYes
$linearFillYesYesYes
$locfYesYesYes
$minNYesYesYes
$rankYesYesYes
$shiftYesYesYes
$stdDevSampYesYesYes
$topYesYesYes
$topNYesYesYes
Conditional Expression Operators$condYesYesYes
$ifNullYesYesYes
$switchYesYesYes
Aggregation Pipeline Stages$addFieldsYesYesYes
$bucketYesYesYes
$bucketAutoNoNoNo
$changeStreamNoNoNo
$changeStreamSplitLargeEventNoNoNo
$collStatsYesYesYes
$countYesYesYes
$densifyYesYes
$documentsNoNo
$facetYesYesYes
$fillYesYes
$geoNearYesYesYes
$graphLookupYesYesYes
$groupYesYesYes
$indexStatsYesYesYes
$limitYesYesYes
$listSampledQueriesNoNoNo
$listSearchIndexesNoNoNo
$listSessionsNoNoNo
$lookupYesYesYes
$matchYesYesYes
$mergeYesYesYes
$outYesYesYes
$planCacheStatsNoNoNo
$projectYesYesYes
$redactNoNoNo
$replaceRootYesYesYes
$replaceWithYesYesYes
$sampleYesYesYes
$searchYesYesYes
$searchMetaYesYesYes
$setYesYesYes
$setWindowFieldsYesYesYes
$skipYesYesYes
$sortYesYesYes
$sortByCountYesYesYes
$unionWithNoNoNo
$unsetYesYesYes
$unwindYesYesYes
$shardedDataDistributionNoNoNo
$changeStreamNoNoNo
$currentOpYesYesYes
$listLocalSessionsNoNoNo
$documentsNoNoNo
Variables in Aggregation ExpressionsNOWNoNoNo
ROOTYesYesYes
REMOVEYesYesYes
CURRENTYesYesYes
CLUSTER_TIMENoNoNo
DESCENDNoNoNo
PRUNENoNoNo
KEEPNoNoNo
SEARCH_METANoNoNo
USER_ROLESNoNoNo

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

CommandSupported
Single Field IndexYes
Compound IndexYes
Multikey IndexYes
Text IndexYes
Wildcard IndexYes
Geospatial IndexYes
Hashed IndexYes

Index properties

CommandSupported
TTLYes
UniqueYes
PartialYes
Case InsensitiveNo
SparseYes
BackgroundYes

Next steps