Node.js 如何通过mongojs了解mongodb版本

Node.js 如何通过mongojs了解mongodb版本,node.js,mongodb,mongojs,Node.js,Mongodb,Mongojs,我想知道使用mongojs的mongodb版本。试试这个: dburl = "mongodb://127.0.0.1:27017/demo"; db = require('mongojs').connect(dburl); console.log(db.version); 编辑:较短版本,使用: 要获取可执行的命令列表,请执行以下操作: db.command({ buildInfo : 1 }, function(err, buildinfo) { console.log('V', bui

我想知道使用mongojs的mongodb版本。

试试这个:

dburl = "mongodb://127.0.0.1:27017/demo";
db = require('mongojs').connect(dburl);
console.log(db.version);
编辑:较短版本,使用:

要获取可执行的命令列表,请执行以下操作:

db.command({ buildInfo : 1 }, function(err, buildinfo) {
  console.log('V', buildinfo.version);
});

谢谢,罗伯特,它很好用。您能告诉我从哪里可以获得db.executeDbCommand教程吗?@RohitJindal我认为
executeDbCommand
不受欢迎,我编辑了我的答案,以显示一种替代方法,以及列出所有可用命令的方法。
db.command({ buildInfo : 1 }, function(err, buildinfo) {
  console.log('V', buildinfo.version);
});
db.command({ listCommands : 1 }, function(err, response) {
  console.log(response.commands);
});