Hi.
In the Schema Versioning Pattern we put a field to register the current version of our documents, but there is already a field version in MongoDb documents.
What is the difference? Why can we use this field instead?
Thank you,
Hi.
In the Schema Versioning Pattern we put a field to register the current version of our documents, but there is already a field version in MongoDb documents.
What is the difference? Why can we use this field instead?
Thank you,
There is not. What makes you think that?
For instance when i create a document with Mongoose, i have a field called “__v” that has the version of the document and i didn’t create it:
{"_id":{"$oid":"5fd34788a1f0ca2c2007b758"},"tipo":"tutor","activo":false,"username":"anubedam","password":"$2a$10$hgFcxCw9EG/XaOuxdsaebejOiWSc44psSM.RvaI2tyz.pzeWT.og6","nombre":"Antonio","apellidos":"Úbeda Montero","email":"anubedam@gmail.com","__v":0}
It is Mongoose, not MongoDB.
It might be an artifact of your Mongoose schema. It is not clear if __v is for the version of the schema or the version of the document. If the former, then Mongoose helps you to implement the Schema Versioning Pattern.