MongoCollectionAggregate
MongoCollectionAggregate[MongoCollection[…],pipeline]
calculates aggregate values for the data in a MongoCollection.
Details and Options
- To use MongoCollectionAggregate, you first need to load MongoLink using Needs["MongoLink`"].
- pipeline is a list of associations. The available aggregation pipeline operators can be found in the MongoDB documentation.
- More information about the aggregation pipeline can be found in the MongoDB documentation.
- MongoCollectionAggregate corresponds to db.collection.aggregate() in the MongoDB documentation.
Examples
Basic Examples (1)Summary of the most common use cases

https://wolfram.com/xid/079wghuqzgqaz1c4hdxd6bdhw-zzezdv

https://wolfram.com/xid/079wghuqzgqaz1c4hdxd6bdhw-scph7c

Connect to a the "WolframTestCollection" collection in the "WolframTestDB" database:

https://wolfram.com/xid/079wghuqzgqaz1c4hdxd6bdhw-y3waiz

Aggregate values for count and average, grouped by sex:

https://wolfram.com/xid/079wghuqzgqaz1c4hdxd6bdhw-0abmtr


https://wolfram.com/xid/079wghuqzgqaz1c4hdxd6bdhw-gi694i

Wolfram Research (2018), MongoCollectionAggregate, Wolfram Language function, https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
Text
Wolfram Research (2018), MongoCollectionAggregate, Wolfram Language function, https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
Wolfram Research (2018), MongoCollectionAggregate, Wolfram Language function, https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
CMS
Wolfram Language. 2018. "MongoCollectionAggregate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
Wolfram Language. 2018. "MongoCollectionAggregate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
APA
Wolfram Language. (2018). MongoCollectionAggregate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html
Wolfram Language. (2018). MongoCollectionAggregate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html
BibTeX
@misc{reference.wolfram_2025_mongocollectionaggregate, author="Wolfram Research", title="{MongoCollectionAggregate}", year="2018", howpublished="\url{https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html}", note=[Accessed: 09-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_mongocollectionaggregate, organization={Wolfram Research}, title={MongoCollectionAggregate}, year={2018}, url={https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html}, note=[Accessed: 09-July-2025
]}