db.open(... throws the following error
TypeError: boolean is not a function
The res function returns a function so not sure what I'm doing wrong here...
var db = new Db('test', new Server('localhost', 27017, {auto_reconnect: true}, {}));
function res(win) {
return function(err,result){
if( err ) {
util.debug('mongo:err='+err);
db.close();
}
else {
util.debug('mongo:ok, about to call function');
win(result);
}
}
}
exports.saveCreditCheck = function(req, res){
util.debug('*** in saveCreditCheck ***');
db.open(res(function(){
util.debug('mongo:ok');
}));
};
BTW, this works fine..
db.open(function(){
util.debug('mongo:ok');
});
I'm not sure why but restarting mongodb seemed to fix this issue. I can confirm that above code does actually work.