MongoDB compatibility and feature support with Azure Cosmos DB for MongoDB vCore
Article
APPLIES TO:
MongoDB vCore
Azure Cosmos DB is Microsoft's fully managed NoSQL and relational database, offering multiple database APIs. You can communicate with Azure Cosmos DB for MongoDB using the MongoDB drivers, SDKs and tools you're already familiar with. Azure Cosmos DB for MongoDB enables the use of existing client drivers by adhering to the MongoDB wire protocol.
By using the Azure Cosmos DB for MongoDB, you can enjoy the benefits of the MongoDB you're used to, with all of the enterprise capabilities that Azure Cosmos DB provides.
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.
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.
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 operations, operators, stages, commands, and options.
Database commands
Azure Cosmos DB for MongoDB vCore supports the following database commands:
Query and write operation commands
Command
Supported
change streams
No
delete
Yes
find
Yes
findAndModify
Yes
getLastError
No
getMore
Partial
insert
Yes
resetError
No
update
Yes
Session commands
Command
Supported
abortTransaction
Yes
commitTransaction
Yes
endSessions
No
killAllSessions
No
killAllSessionsByPattern
No
killSessions
No
refreshSessions
No
startSession
Yes
Authentication commands
Command
Supported
authenticate
No
getnonce
No
logout
Yes
Geospatial command
Command
Supported
geoSearch
No
Query Plan Cache commands
Command
Supported
planCacheClear
No
planCacheClearFilters
No
planCacheListFilters
No
planCacheSetFilter
No
Administration commands
Command
Supported
cloneCollectionAsCapped
No
collMod
Partial
compact
No
connPoolSync
No
convertToCapped
No
create
Partial
createIndexes
Yes
currentOp
No
drop
Yes
dropDatabase
Yes
dropConnections
No
dropIndexes
Yes
filemd5
No
fsync
No
fsyncUnlock
No
getDefaultRWConcern
No
getClusterParameter
No
getParameter
No
killCursors
Yes
killOp
No
listCollections
Yes
listDatabases
Yes
listIndexes
Yes
logRotate
No
reIndex
Yes
renameCollection
Yes
rotateCertificates
No
setFeatureCompatibilityVersion
No
setIndexCommitQuorum
No
setParameter
No
setDefaultRWConcern
No
shutdown
No
User Management commands
Command
Supported
createUser
No
dropAllUsersFromDatabase
No
dropUser
No
grantRolesToUser
No
revokeRolesFromUser
No
updateUser
No
usersInfo
No
Role Management commands
Command
Supported
createRole
No
dropRole
No
dropAllRolesFromDatabase
No
grantPrivilegesToRole
No
grantRolesToRole
No
invalidateUserCache
No
revokePrivilegesFromRole
No
revokeRolesFromRole
No
rolesInfo
No
updateRole
No
Replication commands
Command
Supported
applyOps
No
hello
Yes
replSetAbortPrimaryCatchUp
No
replSetFreeze
No
replSetGetConfig
No
replSetGetStatus
No
replSetInitiate
No
replSetMaintenance
No
replSetReconfig
No
replSetResizeOplog
No
replSetStepDown
No
replSetSyncFrom
No
Sharding commands
Command
Supported
abortReshardCollection
No
addShard
No
addShardToZone
No
balancerCollectionStatus
No
balancerStart
No
balancerStatus
No
balancerStop
No
checkShardingIndex
No
clearJumboFlag
No
cleanupOrphaned
No
cleanupReshardCollection
No
commitReshardCollection
No
configureCollectionBalancing
No
enableSharding
Yes
flushRouterConfig
No
getShardMap
No
getShardVersion
No
isdbgrid
No
listShards
No
medianKey
No
moveChunk
No
movePrimary
No
mergeChunks
No
refineCollectionShardKey
No
removeShard
No
removeShardFromZone
No
reshardCollection
Yes
setShardVersion
No
shardCollection
Yes
shardingState
No
split
No
splitVector
No
unsetSharding
No
updateZoneKeyRange
No
Diagnostics commands
Command
Supported
availableQueryOptions
No
buildInfo
Yes
collStats
No
connPoolStats
No
connectionStatus
Partial
cursorInfo
No
dataSize
No
dbHash
No
dbStats
No
driverOIDTest
No
explain
Yes
features
No
getCmdLineOpts
No
getLog
Yes
hostInfo
Partial
_isSelf
No
listCommands
No
lockInfo
No
netstat
No
ping
Yes
profile
No
serverStatus
No
shardConnPoolStats
No
top
No
validate
Yes
whatsmyuri
Yes
Free Monitoring Commands
Command
Supported
getFreeMonitoringStatus
No
setFreeMonitoring
No
Auditing command
Command
Supported
logApplicationMessage
No
Aggregation pipeline
Azure Cosmos DB for MongoDB vCore supports the following aggregation pipeline features:
The $lookup aggregation does not yet support using variable expressions using 'let'.
Boolean expressions
Command
Supported
and
Yes
not
Yes
or
Yes
Type expressions
Command
Supported
$type
Yes
$toLong
Yes
$toString
Yes
$convert
Yes
$toDate
Yes
$toDecimal
Yes
$toObjectId
Yes
$toDouble
Yes
$toBool
Yes
$toInt
Yes
$isNumber
Yes
Set expressions
Command
Supported
$anyElementTrue
No
$setUnion
No
$allElementsTrue
No
$setIntersection
No
$setDifference
No
$setEquals
No
$setIsSubset
No
Comparison expressions
Command
Supported
$ne
Yes
$lte
Yes
$gt
Yes
$gte
Yes
$lt
Yes
$eq
Yes
$cmp
Yes
Custom Aggregation expressions
Command
Supported
$accumulator
No
$function
No
Data size Operators
Command
Supported
$binarySize
No
$bsonSize
No
Arithmetic expressions
Command
Supported
$add
Yes
$multiply
Yes
$subtract
Yes
$divide
Yes
$ceil
Yes
$floor
Yes
$trunc
Yes
$abs
Yes
$mod
Yes
$pow
Yes
$sqrt
Yes
$exp
Yes
$ln
Yes
$log
Yes
$log10
Yes
$round
Yes
Timestamp expressions
Command
Supported
$tsIncrement
No
$tsSecond
No
Trigonometry expressions
Command
Supported
$sin
No
$cos
No
$tan
No
$asin
No
$acos
No
$atan
No
$atan2
No
$asinh
No
$acosh
No
$atanh
No
$sinh
No
$cosh
No
$tanh
No
$degreesToRadians
No
$radiansToDegrees
No
String expressions
Command
Supported
$concat
No
$dateToString
Yes
$toLower
No
$toString
No
$substr
No
$split
No
$strLenCP
No
$toUpper
No
$indexOfCP
No
$substrCP
No
$ltrim
No
$substrBytes
No
$indexOfBytes
No
$trim
No
$strLenBytes
No
$dateFromString
No
$regexFind
No
$regexFindAll
No
$regexMatch
No
$replaceOne
No
$replaceAll
No
$rtrim
No
$strcasecmp
No
Text expression Operator
Command
Supported
$meta
No
Array expressions
Command
Supported
$in
Yes
$size
Yes
$arrayElemAt
Yes
$slice
Yes
$filter
No
$map
No
$objectToArray
Yes
$arrayToObject
Yes
$reduce
No
$indexOfArray
No
$concatArrays
Yes
$isArray
Yes
$zip
No
$reverseArray
No
$range
No
$first
Yes
$firstN
No
$last
Yes
$lastN
No
$maxN
No
$minN
No
$sortArray
No
Variable operator
Command
Supported
$let
No
System variables
Command
Supported
$$CLUSTERTIME
No
$$CURRENT
No
$$DESCEND
No
$$KEEP
No
$$NOW
No
$$PRUNE
No
$$REMOVE
No
$$ROOT
No
Window operators
Command
Supported
$sum
No
$push
No
$addToSet
No
$count
No
$max
No
$min
No
$avg
No
$stdDevPop
No
$bottom
No
$bottomN
No
$covariancePop
No
$covarianceSamp
No
$denseRank
No
$derivative
No
$documentNumber
No
$expMovingAvg
No
$first
No
$integral
No
$last
No
$linearFill
No
$locf
No
$minN
No
$rank
No
$shift
No
$stdDevSamp
No
$top
No
$topN
No
Literal operator
Command
Supported
$literal
Yes
Date expressions
Command
Supported
$dateToString
Yes
$month
Yes
$year
Yes
$hour
Yes
$minute
Yes
$second
Yes
$dayOfMonth
Yes
$week
Yes
$millisecond
Yes
$toDate
Yes
$dateToParts
Yes
$dayOfWeek
Yes
$dayOfYear
Yes
$isoWeek
Yes
$isoWeekYear
Yes
$isoDayOfWeek
Yes
$dateAdd
No
$dateDiff
No
$dateFromParts
No
$dateFromString
No
$dateSubtract
No
$dateTrunc
No
Conditional expressions
Command
Supported
$cond
Yes
$ifNull
Yes
$switch
Yes
Accumulator expressions
Command
Supported
$accumulator
No
$addToSet
No
$avg
Yes
$bottom
No
$bottomN
No
$count
Yes
$first
Yes
$firstN
No
$last
Yes
$lastN
No
$max
Yes
$maxN
No
$mergeObjects
No
$min
Yes
$push
No
$stdDevPop
No
$stdDevSamp
No
$sum
Yes
$top
No
$topN
No
$stdDevPop
No
$stdDevSamp
No
$sum
Yes
Miscellaneous operators
Command
Supported
$getField
No
$rand
Yes
$sampleRate
No
Object expressions
Command
Supported
$mergeObjects
Yes
$objectToArray
Yes
$setField
No
Data types
Azure Cosmos DB for MongoDB supports documents encoded in MongoDB BSON format.
Command
Supported
Double
Yes
String
Yes
Object
Yes
Array
Yes
Binary Data
Yes
ObjectId
Yes
Boolean
Yes
Date
Yes
Null
Yes
32-bit Integer (int)
Yes
Timestamp
Yes
64-bit Integer (long)
Yes
MinKey
Yes
MaxKey
Yes
Decimal128
Yes
Regular Expression
Yes
JavaScript
Yes
JavaScript (with scope)
Yes
Undefined
Yes
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.