These are chat archives for Automattic/mongoose

15th
Jun 2018
arbalu
@arbalu
Jun 15 2018 03:07
I am facing one issue with Mongoose. When I use find or findOne method and there is no matching results, then callback function is not returning null / err and hung the process. Using Mongoss 5.1.5 , MongoDB V3.4.2. Please advise
arbalu
@arbalu
Jun 15 2018 03:12

module.exports.validateappsubscripition = function (userid, appkey, cb) {
//console.error(userid + ' ' + appkey)
var userobj_id = mongoose.Types.ObjectId(userid);
appsubscripitions.model.findOne({'subscribersuserid': userobj_id , 'appkey' :appkey }, function(err,doc){
console.error('test2');
if(doc ){
cb(null, doc );
}
else{

        cb(null, null );
    }

} ); 

}