Context: I have a Post
Mongoose model that contains a csv_files
array field to store csv strings. I make a fetch
API
When saving an object to Mongo DB you have to understand that Mongo DB has a version control system in place. This helps ensure that if you save an object once, when saving it again you don't end up overwriting the previously saved data.
This is the error you're seeing. If you want to force the object to update regardless of version control in this particular instance you may want to use .update() instead. This will force the object to be updated regardless of its currently saved state.
This is because .save() watches and cares about version controls, while .update() will update the object regardless of version control.