What is the db.collection.stats() command in mongoose?
Had the same problem and managed to query it this way:
YourModel.collection.stats(callback);
You basically access a Model
's native interface via the collection
property (this is not the collection name, but a property in fact called collection
). You can then use any native functions on this object.
You can run any arbitrary command via executeDbCommand so since stats is just a database command, you can runCommand that stats() does under the hood:
db.runCommand( { collstats : collectionName } );