Navigation

CRUD & Aggregation APIs

Overview

You can access most of the CRUD and Aggregation functionality of MongoDB version 3.6 with the MongoDB service; however, MongoDB Realm does not support all operations available in standard tools and clients. This page lists specific MongoDB operations that are not available when you connect to MongoDB Atlas through MongoDB Realm. For a high-level overview of MongoDB feature availability in MongoDB Realm, see Service Limitations.

Note

The following tables track operation support with the labels “User Function” and “System Function”. A “User Function” is a Function run using an application user’s user context only. This is the default behavior for all Functions, and in this kind of Function all rules, roles, and permissions apply to the active user. A “System Function” is a Function run without regard for rules, roles, and permissions. You can learn more about how to run a Functions as a system user in the Functions overview.

CRUD Operations

Query Operators

MongoDB Realm supports most query operators for queries that run in a user function. However, some evaluation operators and all geospatial and bitwise operators are only available in system functions.

Comparison Operator Availability

Operation User Function System Function
$eq Yes Yes
$gt Yes Yes
$gte Yes Yes
$in Yes Yes
$lt Yes Yes
$lte Yes Yes
$ne Yes Yes
$nin Yes Yes

Logical Operator Availability

Operation User Function System Function
$and Yes Yes
$not Yes Yes
$nor Yes Yes
$or Yes Yes

Array Operator Availability

Operation User Function System Function
$all Yes Yes
$elemMatch Yes Yes
$size Yes Yes

Element Operator Availability

Operation User Function System Function
$exists Yes Yes
$type Yes Yes

Evaluation Operator Availability

Operation User Function System Function
$mod Yes Yes
$expr No Yes
$jsonSchema No Yes
$regex No Yes
$text No Yes
$where No Yes

Geospatial Operator Availability

Operation User Function System Function
$geoIntersects No Yes
$geoWithin No Yes
$near No Yes
$nearSphere No Yes

Bitwise Operator Availability

Operation User Function System Function
$bitsAllClear No Yes
$bitAllSet No Yes
$bitsAnyClear No Yes
$bitsAnySet No Yes

Update Operators

MongoDB Realm supports most update operators for queries that run in a user function. However, some array update operators are only available in system functions.

Field Update Operator Availability

Operation User Function System Function
$currentDate Yes Yes
$inc Yes Yes
$min Yes Yes
$max Yes Yes
$mul Yes Yes
$rename Yes Yes
$set Yes Yes
$setOnInsert Yes Yes
$unset Yes Yes

Array Update Operator Availability

Operation User Function System Function
$ (Positional Update) Yes Yes
$addToSet Yes Yes
$pop Yes Yes
$pull Yes Yes
$push Yes Yes
$pullAll Yes Yes
$[] (All Positional Update) No Yes
$[element] (Filtered Positional Update) No Yes

Array Update Operator Modifiers Availability

Modifier User Function System Function
$each Yes Yes
$position Yes Yes
$slice Yes Yes
$sort Yes Yes

Bitwise Update Operator Availability

Operator User Function System Function
$bit Yes Yes

Bulk Write Operations

MongoDB Realm does not support any bulk write operations.

Bulk Write Operation Availability

Operation User Function System Function
insertOne No No
replaceOne No No
updateOne No No
updateMany No No
deleteMany No No
deleteOne No No

Query Options

MongoDB Realm does not support configuring the following options for any CRUD operation in user functions. All query options are available in system functions.

Query Option Availability

Modifier User Context System Context
Read Isolation (Read Concern) No Yes
Write Acknowledgment (Write Concern) No Yes
Collation No Yes

Aggregation

MongoDB Realm does not support the following aggregation pipeline stages when you run an aggregation pipeline in the context of an application user. All aggregation pipeline stages are available to the system user except $indexStats and $currentOp.

Aggregation Pipeline Stage Availability

Modifier User Context System Context
$collStats No Yes
$currentOp No No
$lookup No Yes
$out No Yes
$indexStats No No
$facet No Yes
$graphLookup No Yes
$text No Yes
$geoNear No Yes

Database Commands

MongoDB Realm does not support any database commands in the Client SDKs or Functions. You can, however, call a limited subset of database commands when when connected to a MongoDB cluster over the MongoDB Realm wire protocol.

The following database commands are partially supported over the wire protocol. Unsupported options for each command are listed below.

Database Command Availability

Command Unsupported Options
find
  • hint
  • skip
  • batchSize
  • comment
  • maxScan
  • maxTimeMS
  • readConcern
  • max
  • min
  • returnKey
  • showRecordId
  • tailable
  • awaitData
  • oplogReplay
  • noCursorTimeout
  • allowPartialResults
  • collation
aggregate
  • explain
  • allowDiskUse
  • maxTimeMS
  • readConcern
  • collation
  • bypassDocumentValidation
  • hint
  • comment
  • writeConcern
count
  • limit
  • skip
  • hint
  • readConcern
insert
  • writeConcern
  • bypassDocumentValidation
update
  • bypassDocumentValidation
  • collation
  • arrayFilters
delete
  • collation