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, Stitch 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 through Stitch. For a high-level overview of MongoDB feature availability in Stitch, 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 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 Function as a system user in the Functions overview.

CRUD Operations

Query Operators

Stitch 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

Stitch 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 No
$[ No No

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

Stitch 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

Stitch 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

Stitch 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
$geoNear No Yes
$search No Yes

Database Commands

Stitch does not support any database commands in the Client SDKs or Functions. You can, however, call a limited subset of database commands when connected to a MongoDB cluster over the Stitch 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