Little tip about version control in Mongoose

This post was published 4 years ago. It may be exremely outdated.

Did you ever encountered this message when working with Mongoose?

VersionError: No matching document found.

This is a good explanation about version control in Mongoose, what it is and why it is useful.

If you are inserting content into the database with MongoDB driver and updating it using Mongoose, be careful! __v won’t be set and if any of your document attributes is an array you can get easily in trouble.