I am trying to post data to database that I have created on mLab and I am getting this error but I don\'t know whats going wrong.I also have read previously asked question o
MongoClient.connect(db.url,(err,database) =>{
if (err) return console.log(err)
//require('./app/routes')(app,{});
//try this
require('./app/routes')(app,database);
app.listen(port,() => {
console.log("We are live on"+port);
});
})
here you have to include the database in the empty {}.
or
you can also try installing mongodb to latest which will solve the issue.
npm install mongodb@2.2.33 --save
else npm install add dependency of "mongodb": "^2.2.33" in node modules.