MongoCollectionCount
MongoCollectionCount[MongoCollection[…]]
counts the number of documents in MongoCollection.
MongoCollectionCount[MongoCollection[…], query]
counts the number of documents in MongoCollection matching the query query.
Details and Options
- To use MongoCollectionCount, you first need to load MongoLink using Needs["MongoLink`"].
- query is an Association.
- See "Query and Projection Operators" in the MongoDB manual for available query operators.
- MongoCollectionCount corresponds to db.collection.count in the MongoDB manual.
Examples
Basic Examples (1)Summary of the most common use cases

https://wolfram.com/xid/0cy2p0811k8i164acqum0z2-zzezdv

https://wolfram.com/xid/0cy2p0811k8i164acqum0z2-scph7c

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

https://wolfram.com/xid/0cy2p0811k8i164acqum0z2-y3waiz

Count the number of documents in the collection:

https://wolfram.com/xid/0cy2p0811k8i164acqum0z2-f86n02

Count the number of documents in the collection that match the query <|"sex""female"|>:

https://wolfram.com/xid/0cy2p0811k8i164acqum0z2-bccovj

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