I’m fairly new to document databases. 25 years on relational. In relational, you could count on the model changing at some point. DDL change script in Dev. Test. Staging. Release to Prod. Done.
Here in MongoDB, I understand you simply insert into collection X a document with a different shape. But in order not to leave a steaming pile of different documents, I understand it is wise to use a field to version the schema kept in the collection. Then the code has to have logic control to handle the version differences.
What are your recommendations for a schema versioning field, something that has worked well for you? As in:
field name?
field datatype as number or string?
if string, what format or numbering scheme within the string has worked well for you?