I am using mongodb 3.0.2 with mongoose 4.0 in nodejs
- 当我将 mongoose 2.3 升级到 4.0 时,它开始抛出错误 'executeDbCommand',看起来这在 mongoose 4.0 中已被弃用, 有人有替换这个命令的想法吗?
我试图深入 Mongoose ,但找不到它,如果有人知道请帮助我!!
最佳答案
Mongoose 使用 native driver本身原型(prototype),api 文档说 native 驱动器有一个 command method 。代码将是:
var db = mongoose.createConnection('mongodb://user:pass@localhost:port/database');
db.command('sample command');
关于node.js - Get对象没有方法 'executeDbCommand',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29897247/