tingodb
tingodb copied to clipboard
Is this compatible with */yield/co?
This seems to be fine:
users.findOne(function (err, result) {
if (err) console.error(err);
console.log(result)
});
However this doesn't seem to work:
co(function *() {
var list = yield users.findOne().toArray();
console.log(list);
}).catch((err)=>{
console.log(err);
});
I don't expect your example to work, because collection.findOne()
doesn't return a promise.