this.mongo.db('zhuwenlong').collection('blog').findOne({}, function(err, doc) {
console.log('xxxx', err, doc);
//MongoError: not authorized for query on abc.blog
})
why I have to auth again ?
like this
this.mongo.authenticate("zhuwenlong", "123123",function(err,ret){
this.mongo.db('zhuwenlong').collection('blog').findOne({}, function(err, doc) {
console.log('xxxx', err, doc);
//MongoError: not authorized for query on abc.blog
})
})
2.but when I use it , it return an error
why I have to auth again ? like this