Monday, 30 November 2015

message: "No matching document found.", name: "VersionError mongodb


message: "No matching document found.", name: "VersionError

you may see this error, when you update your mongodb.

Somebody have some solution online:

http://stackoverflow.com/questions/21099904/node-mongoose-on-save-versionerror-no-matching-document-found

http://mongoosejs.com/docs/guide.html#versionKey

Before you doing above solution , please check my comments below first:

If you don't have this error when you first time do update operation. but you got this error after the first time.  That is something else, above solutions are not suit for you. you should follow my solution below:

Because after you successfully done your first update, you haven't update your data version. usually you can get the updated data by parsing the updating response.




If my explanation doesn't suit your condition, then make sure you are not using "__v" as a filed of your object. because this is a default field which is used by mongodb. you can follow this to change the field name for version: http://mongoosejs.com/docs/guide.html#versionKey










No comments:

Post a comment