“无法validation”与promised-mongo

我使用Promised-Mongo从NodeJS后端代码连接MongoDB和Promises。 它工作正常,直到我启用MongoDB的客户端访问控制。 当我运行这个代码时,我得到“无法validation”消息“:

var pmongo = require('promised-mongo').compatible(); var db = pmongo('myusername:mypassword@localhost/mydb', ['candidates']); db.candidates.save(req.body) .then(function () { // never reached here }) .catch(function (e) { // it reached here, where e.message says "could not authenticate" }); 

纯粹的MongoDB代码(即没有承诺…)工作正常:

 var mongodb = require('mongodb'); var uri = 'mongodb://myusername:mypassword@localhost/mydb'; mongodb.MongoClient.connect(uri, function (err, db) { if (err) { // never reached here } var candidates = db.collection('candidates'); candidates.insert(req.body, function(err, result) { if (err) { // never reached here } res.send('{result: success}'); }); }); 

任何想法?

在github存储库中的几个问题(看这里和这里 )看起来像使用这个库与authentication是完全破碎。 根据第二个链接,大多数人似乎正在通过Promisify,蓝鸟或薄的自定义包装等方式包装官方图书馆。