计算MongoDB中的项目

Sam*_*Sam 10 c# mongodb

如何使用2.x C#驱动程序计算Mongo集合中所有项目的数量?

我正在尝试使用CountAsync,我需要传递一个过滤器.我不想过滤 - 我希望一切都归还.

Dev*_*esh 16

您始终可以像这样在方法中传递空文档

db.collection.CountAsync(new BsonDocument());
Run Code Online (Sandbox Code Playgroud)