Mongoose : error returned is empty object Mongoose : error returned is empty object mongoose mongoose

Mongoose : error returned is empty object


Found the Problem : conditions doesn't met schema :/ nevertheless bad behavior from mongo/mongoose

Error : {}

var conditions = { foo: bar};

Solution :

var conditions = { foo: new ObjectId(bar._id)};

Need to refer on ObjectId instead on Object


I'm not sure if Mongoose provide us with "findoneandupdate" you got

.save()

Instead you can try this code:

Model.findOne({ name: 'bourne' }, function (err, doc){  doc.name = 'jason bourne';  doc.visits.$inc();  doc.save();});

Here is the link to Docs.

Try this if it doesn't work, please specify the conditions and payload.