this is my data.config file
DbProvider.prototype.doOperation = function(collection, operation, params, callback)
{
this.validateParams(params, callback);
var operationCallback = function(err, result)
{
callback(err, result);
};
this.db.collection(collection, function(err, collection) {
if(operation==='find') {
collection.find().toArray(operationCallback);
} else {
collection[operation](params, operationCallback);
}
});
}
DbProvider.prototype.findUser = function(params, callback)
{
this.doOperation('users', 'findOne', params, callback);
};
i have tried to find id exit or not by this way
dbProvider.findUser({_id:"514fdb464f2c06a9d6003afb"},function(err,result)
{
console.log("welcome");
});
but i got this error Cannot call method 'collection' of null how to resolve this...