Using the native driver I can run a command off of the db object as follows:
var MongoClient = require("mongodb").MongoClient;
MongoClient.connect(database, function (err, db) {
if (!err) {
db.command({ distinct: "Messages", key: "session" }, function (err, result) {
//more code here
});
}
});
I noticed you are running the command off of the collection object, that might be the problem.