MongoCollectionAggregate[MongoCollection[…],pipeline]
calculates aggregate values for the data in a MongoCollection.
MongoCollectionAggregate
MongoCollectionAggregate[MongoCollection[…],pipeline]
calculates aggregate values for the data in a MongoCollection.
更多信息和选项
- 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.
范例
基本范例 (1)
Needs["MongoLink`"]client = MongoConnect[]Connect to a the "WolframTestCollection" collection in the "WolframTestDB" database:
coll = client["WolframTestDB"]["WolframTestCollection"]Aggregate values for count and average, grouped by sex:
agg = MongoCollectionAggregate[coll, {<|"$group" -> <|"_id" -> <|"sex" -> "$sex"|>, "count" -> <|"$sum" -> 1|>, "average" -> <|"$avg" -> "$age"|>|>|>}]Dataset[agg]技术笔记
相关指南
文本
Wolfram Research (2018),MongoCollectionAggregate,Wolfram 语言函数,https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
CMS
Wolfram 语言. 2018. "MongoCollectionAggregate." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html.
APA
Wolfram 语言. (2018). MongoCollectionAggregate. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html 年
BibTeX
@misc{reference.wolfram_2026_mongocollectionaggregate, author="Wolfram Research", title="{MongoCollectionAggregate}", year="2018", howpublished="\url{https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html}", note=[Accessed: 12-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_mongocollectionaggregate, organization={Wolfram Research}, title={MongoCollectionAggregate}, year={2018}, url={https://reference.wolfram.com/language/MongoLink/ref/MongoCollectionAggregate.html}, note=[Accessed: 12-August-2026]}