| |
read source history
= aggregate() =
----
[[MongoDB Driver Function Reference]]
Runs an (admin/diagnostic) aggregation that does not require a collection.
More information can be found in the corresponding entry of the [[https://docs.mongodb.com/manual/reference/method/db.aggregate/index.html|MongoDB Manual]].
[[[@cG
db.aggregate([<pipeline>[, <options>]])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <pipeline> | | An array of BSON documents specifying the [[https://docs.mongodb.com/manual/core/aggregation-pipeline/#id1|aggregation pipline]]. |
| <options> | | A BOSN document specifying options. |
]]]
**Options**
[[[@cw
{ allowDiskUse: <boolean>, batchSize: <int>, comment: <string>, maxAwaitTime: <long>,
collation: <document>, hint: <document>, bypass }
<<@f:text>>
|@t0@r0@c0 allowDiskUse | | Allows to write to disk while executing. |
| batchSize | | Sets the batch size. |
| bypassDocumentValidation | | Document validation will be bypassed (default; false). |
| comment | | Sets the comment. |
| maxAwaitTime | | Sets the maximum await time (in milliseconds). |
| collation | | A document specifying the [[https://docs.mongodb.com/manual/reference/bson-type-comparison-order/#collation|collation]]. |
| hint | | A document specifying a [[https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany/#ex-deletemany-hint|hint]]. |
<<@/f>>
]]]
**Return Value**
[[[@w
Returns a result set (cursor).
]]]
**Example**
[[[@cw
db.aggregate([{ $currentOp : { allUsers: true, idleConnections: true } }, { $match : { shard: "shard01" } }]);
]]]
Runs the currentOp operation and filters the results.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|