我可能遗漏了一些非常明显的东西,但现在无法弄清楚 - 如何从 C++ 驱动程序查询 MongoDB 中的“db.collectionname.stats()”?
最佳答案
您需要使用该命令的 MongoDB runCommand 版本,collStats:
{ collStats: "collection" , scale : 1024 }
它在集合“collection”上运行 stats(),以千字节为单位显示结果。
http://docs.mongodb.org/manual/reference/command/collStats/
要使用 c++ 驱动程序发出 runCommands,您需要使用 DBClientWithCommands::runCommand()
:
关于c++ - MongoDB 从 C++ 调用 stats(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24456374/