C# Mongo Driver IMongoDatabase RunCommand to get database stats
问题 IMongoDatabase does not support db.GetStats(); which is deprecated in new version. I want to try alternate approach to get database stats. I use the following code to run command as we can get the stats from shell: var client = new MongoClient("mongodb://localhost:27017/analytics"); var db = client.GetDatabase("analytics"); var stats = db.RunCommand<BsonDocument>("db.stats()"); var collectionNames = db.RunCommand<BsonDocument> ("db.getCollectionNames()"); I am getting following error here: