Closed krzysztofpniak closed 8 years ago
Hello @krzysztofpniak, thanks for the report!
I just published version 5.1.0
which should fix your problem. However, note that the error will not provide the list of fields that made the constraint fail, because the driver does not provide it.
If you need that information, please first find your model, then save it using this kind of code (from Mongoose docs):
Model.findById(id, function (err, doc) {
if (err) ..
doc.name = 'jason borne';
doc.save(callback);
});
Does not translate error when save is performed from findOneAndUpdate.