2016-04-22 43 views
0

我有时连接到3.2数据库,有时连接到2.7数据库,具体取决于部署。偶尔,有一个功能在3.2上可用,但不是2.7,所以我需要检查版本。这是我试过的,based on the docs在流星中获取数据库版本

> Meteor.users.rawDatabase().version() 
TypeError: Object [object Object] has no method 'version' 

如何获取流星的数据库版本?

回答

1

你可以尝试使用RemoteCollectionDriver访问底层node.js native driver,然后使用管理数据库的操作:

const adminDb = MongoInternals.defaultRemoteCollectionDriver().mongo.db.admin() 
adminDb.buildInfo((err, info) => { console.log(info.version); })