Simple, with the mongo cli:
db.version ()
How can I do the same with mongoose? How can I send a custom command?
You can use the native mongo driver's Admin#buildInfo
method for that via your Mongoose connection:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test', function(err){
var admin = new mongoose.mongo.Admin(mongoose.connection.db);
admin.buildInfo(function (err, info) {
console.log(info.version);
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With