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.com.

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:

CategoryCommandSupported
Aggregation CommandsaggregateYesYes
countYesYes
distinctYesYes
mapReduceDeprecated
Authentication CommandsauthenticateYesYes
getnonceYesYes
logoutYesYes
Geospatial CommandsgeoSearchDeprecated
Query Plan Cache CommandsNoNo
Administrative CommandscloneCollectionAsCappedNoNo. Capped collections are currently not supported.
collModYesPartial
compactNoNo
connPoolSyncDeprecated
convertToCappedNoNo. Capped collections are currently not supported.
createYesPartial
createIndexesYesYes
currentOpYesYes
dropYesYes
dropDatabaseYesYes
dropConnectionsAs a PaaS service, this will be managed by Azure.
dropIndexesYesYes
filemd5NoNo
fsyncAs a PaaS service, this will be managed by Azure.
fsyncUnlockAs a PaaS service, this will be managed by Azure.
getDefaultRWConcernYesYes
getClusterParameterNoNo
getParameterYesYes
killCursorsYesYes
killOpYesYes
listCollectionsYesYes
listDatabasesYesYes
listIndexesYesYes
logRotateAs a PaaS service, this will be managed by Azure.
reIndexYesYes
renameCollectionYesYes
rotateCertificatesAs a PaaS service, this will be managed by Azure.
setFeatureCompatibilityVersionAs a PaaS service, this will be managed by Azure.
setIndexCommitQuorumNoNo
setParameterYesPartial
setDefaultRWConcernNoNo
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 CommandsenableShardingYesYes
isdbgridYesYes
reshardCollectionYesYes
shardCollectionYesYes
unsetShardingDeprecated
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
reshardCollectionNoNo
Query and Write Operation Commandschange streamsNoNo
deleteYesYes
findYesYes
findAndModifyYesYes
getLastErrorYesYes
getMoreYesPartial
insertYesYes
resetErrorDeprecated
updateYesYes
Session CommandsabortTransactionYesYes
commitTransactionYesYes
endSessionsYesYes
killAllSessionsNoNo
killAllSessionsByPatternNoNo
killSessionsYesYes
refreshSessionsNoNo
startSessionYesYes
Diagnostic CommandsavailableQueryOptionsNoNo
buildInfoYesYes
collStatsYesYes
connPoolStatsNoNo
connectionStatusYesPartial
dataSizeNoNo
dbHashNoNo
dbStatsNoNo
driverOIDTestAs a PaaS service, this will be managed by Azure.
explainYesYes
featuresAs a PaaS service, this will be managed by Azure.
getCmdLineOptsYesYes
getLogYesYes
hostInfoYesPartial
_isSelfNoNo
listCommandsYesYes
lockInfoNoNo
netstatNoNo
pingYesYes
profileAs a PaaS service, this will be managed by Azure.
serverStatusYesYes
shardConnPoolStatsDeprecated
topNoNo
validateYesYes
whatsmyuriYesYes
System Events Auditing CommandslogApplicationMessageNoNo

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" works with document size less than 2KB only.

CategoryOperatorSupported
Comparison Query Operators$eqYesYes
$gtYesYes
$gteYesYes
$inYesYes
$ltYesYes
$lteYesYes
$neYesYes
$ninYesYes
Logical Query Operators$andYesYes
$notYesYes
$norYesYes
$orYesYes
Element Query Operators$existsYesYes
$typeYesYes
Evaluation Query Operators$exprYesYes
$jsonSchemaNoNo
$modYesYes
$regexYesYes
$textYesYes
$whereNoNo
Geospatial OperatorsYesIn Private Preview*
Array Query Operators$allYesYes
$elemMatchYesYes
$sizeYesYes
Bitwise Query Operators$bitsAllClearYesYes
$bitsAllSetYesYes
$bitsAnyClearYesYes
$bitsAnySetYesYes
Projection Operators$YesYes
$elemMatchYesYes
$metaYesYes
$sliceYesYes
Miscellaneous Query Operators$commentNoNo
$randYesYes
$naturalNoNo
Field Update Operators$currentDateYesYes
$incYesYes
$minYesYes
$maxYesYes
$mulYesYes
$renameYesYes
$setYesYes
$setOnInsertYesYes
$unsetYesYes
Array Update Operators$YesYes
$[]YesYes
$[identifier]YesYes
$addToSetYesYes
$popYesYes
$pullYesYes
$pushYesYes
$pullAllYesYes
$eachYesYes
$positionYesYes
$sliceYesYes
$sortYesYes
Bitwise Update Operators$bitYesYes
Arithmetic Expression Operators$absYesYes
$addYesYes
$ceilYesYes
$divideYesYes
$expYesYes
$floorYesYes
$lnYesYes
$logYesYes
$log10YesYes
$modYesYes
$multiplyYesYes
$powYesYes
$roundYesYes
$sqrtYesYes
$subtractYesYes
$truncYesYes
Array Expression Operators$arrayElemAtYesYes
$arrayToObjectYesYes
$concatArraysYesYes
$filterYesYes
$firstNYesYes
$inYesYes
$indexOfArrayYesYes
$isArrayYesYes
$lastNYesYes
$mapNoNo
$maxNNoNo
$minNNoNo
$objectToArrayYesYes
$rangeYesYes
$reduceNoNo
$reverseArrayYesYes
$sizeYesYes
$sliceYesYes
$sortArrayNoNo
$zipNoNo
Bitwise Operators$bitAndYesYes
$bitNotYesYes
$bitOrYesYes
$bitXorYesYes
Boolean Expression Operators$andYesYes
$notYesYes
$orYesYes
Comparison Expression Operators$cmpYesYes
$eqYesYes
$gtYesYes
$gteYesYes
$ltYesYes
$lteYesYes
$neYesYes
Custom Aggregation Expression OperatorsNot supported.
Data Size Operators$bsonSizeYesYes
$binarySizeYesYes
Date Expression Operators$dateAddNoNo
$dateDiffNoNo
$dateFromPartsNoNo
$dateFromStringNoNo
$dateSubtractNoNo
$dateToPartsYesYes
$dateToStringYesYes
$dateTruncNoNo
$dayOfMonthYesYes
$dayOfWeekYesYes
$dayOfYearYesYes
$hourYesYes
$isoDayOfWeekYesYes
$isoWeekYesYes
$isoWeekYearYesYes
$millisecondYesYes
$minuteYesYes
$monthYesYes
$secondYesYes
$toDateYesYes
$weekYesYes
$yearYesYes
Literal Expression Operator$literalYesYes
Miscellaneous Operators$getFieldNoNo
$randYesYes
$sampleRateNoNo
Object Expression Operators$mergeObjectsYesYes
$objectToArrayYesYes
$setFieldYesYes
Set Expression Operators$allElementsTrueYesYes
$anyElementTrueYesYes
$setDifferenceYesYes
$setEqualsYesYes
$setIntersectionYesYes
$setIsSubsetYesYes
$setUnionYesYes
String Expression Operators$concatYesYes
$dateFromStringNoNo
$dateToStringYesYes
$indexOfBytesYesYes
$indexOfCPYesYes
$ltrimYesYes
$regexFindYesYes
$regexFindAllYesYes
$regexMatchYesYes
$replaceOneYesYes
$replaceAllYesYes
$rtrimYesYes
$splitYesYes
$strLenBytesYesYes
$strLenCPYesYes
$strcasecmpYesYes
$substrYesYes
$substrBytesYesYes
$substrCPYesYes
$toLowerYesYes
$toStringYesYes
$trimYesYes
$toUpperYesYes
Text Expression Operator$metaYesYes
Timestamp Expression OperatorsNot supported.
Trigonometry Expression OperatorsNot supported.
Type Expression Operators$convertYesYes
$isNumberYesYes
$toBoolYesYes
$toDateYesYes
$toDecimalYesYes
$toDoubleYesYes
$toIntYesYes
$toLongYesYes
$toObjectIdYesYes
$toStringYesYes
$typeYesYes
Accumulators ($group, $bucket, $bucketAuto, $setWindowFields)$accumulatorNoNo
$addToSetNoNo
$avgYesYes
$bottomNoNo
$bottomNNoNo
$count/td>YesYes
$firstYesYes
$firstNYesYes
$lastYesYes
$lastNYesYes
$maxYesYes
$maxNNoNo
$medianNoNo
$mergeObjectsNoNo
$minYesYes
$percentileNoNo
$pushNoNo
$stdDevPopNoNo
$stdDevSampNoNo
$sumYesYes
$topNoNo
$topNNoNo
Accumulators (in Other Stages)$avgNoNo
$firstYesYes
$lastYesYes
$maxNoNo
$medianNoNo
$minNoNo
$percentileNoNo
$stdDevPopNoNo
$stdDevSampNoNo
$sumNoNo
Variable Expression OperatorsNot supported.
Window OperatorsNot supported.
Conditional Expression Operators$condYesYes
$ifNullYesYes
$switchYesYes
Aggregation Pipeline Stages$addFieldsYesYes
$bucketNoNo
$bucketAutoNoNo
$changeStreamNoNo
$changeStreamSplitLargeEventNoNo
$collStatsYesYes
$countYesYes
$densifyNoNo
$documentsNoNo
$facetYesYes
$fillNoNo
$geoNearNoNo
$graphLookupYesYes
$groupYesYes
$indexStatsYesYes
$limitYesYes
$listSampledQueriesNoNo
$listSearchIndexesNoNo
$listSessionsNoNo
$lookupYesYes
$matchYesYes
$mergeNoNo
$outNoNo
$planCacheStatsNoNo
$projectYesYes
$redactNoNo
$replaceRootYesYes
$replaceWithYesYes
$sampleYesYes
$searchYesYes
$searchMetaYesYes
$setYesYes
$setWindowFieldsNoNo
$skipYesYes
$sortYesYes
$sortByCountYesYes
$unionWithNoNo
$unsetYesYes
$unwindYesYes
$shardedDataDistributionNoNo
$changeStreamNoNo
$currentOpYesYes
$listLocalSessionsNoNo
$documentsNoNo

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 IndexYesYes
Compound IndexYesYes
Multikey IndexYesYes
Text IndexYesYes
Geospatial IndexYesIn Private Preview*
Hashed IndexYesYes
Vector Index (only available in Cosmos DB)YesYes, with vector search

Index properties

CommandSupported
TTLYesYes
UniqueYesYes
PartialYesYes
Case InsensitiveNoNo
SparseYesYes
BackgroundYesYes

Next steps