How to check node-mongodb-native driver version?

☆樱花仙子☆ 提交于 2019-12-11 03:43:43

问题


I am using official node-mongodb-native driver in my project. Which was installed by doing npm install mongodb. However I want to check its version but not sure how to do so.

There is nothing in the READ.ME file of that npm repo.

Please help.

Thanks.


回答1:


According to the npm documentation you can get a list of npm packages and their corresponding versions using npm ls or npm ls -g (for global)




回答2:


The version is exported in index.js:

exports.version = require('../../package').version;

So you can get it by requiring the module and accessing the version property:

var mongo = require('mongodb');
var version = mongo.version;

console.log(version);



回答3:


as of this writing, you can simply npm view <package-name> version (use show in place of view will work too). for example to find out my mongodb module/driver version, npm view mongodb version



来源:https://stackoverflow.com/questions/25683280/how-to-check-node-mongodb-native-driver-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!