Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Creates an aggregate collection.

Component Version macOS Windows Linux Server iOS SDK
MongoDB 13.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "MongoDB.AggregateCollection"; MongoDBRef; Flags; Pipeline { ; Options } )   More


Parameter Description Example Flags
MongoDBRef The reference number for the mongo connection. $MongoDB
Flags The flags. 0
Pipeline The pipeline as JSON. "[
{ "$match" : { "index" : 123 } },
{ "$sort" : { "index" : -1 } },
{ "$limit" : 2 }
Options JSON with options. Optional


Returns OK or error.


Creates an aggregate collection.
This function creates a cursor which sends the aggregate command on the underlying collection upon the first call to MongoDB.CursorNext. For more information on building aggregation pipelines, see the MongoDB Manual entry on the aggregate command.
Sets the current cursor.
Please review the documentation for MongoDB on how to build the JSON for pipeline or options.

None0Specify no query flags.
TailableCursor2Cursor will not be closed when the last data is retrieved. You can resume this cursor later.
SecondaryOk4Allow query of replica set secondaries.
NoCursorTimeout16The server normally times out an idle cursor after an inactivity period (10 minutes). This prevents that.
AwaitData32Use with TailableCursor. Block rather than returning no data. After a period, time out.
Exhaust64Stream the data down full blast in multiple “reply” packets. Faster when you are pulling down a lot of data and you know you want to retrieve it all. Only applies to cursors created from a find operation (i.e. find)
Partial128Get partial results from mongos if some shards are down (instead of throwing an error).

See also

Release notes

Blog Entries

This function checks for a license.

Created 3th February 2023, last changed 3th February 2023

MongoDB.AbortTransaction - MongoDB.AggregateDatabase