Hi
Coming from a relational database background, I like approach 1. I would like to keep the database clean and consistent with the number of fields the same and correctly populated for all records of a collection.
The answer to your question very much depends on how you would like to proceed, e.g. which approach feels more maintainable for you and your team in the future, and which solution aligns better with your application’s use case. For example, following approach #1, would you feel comfortable to perform another datafix should you add more features to your application in the future? In contrast, if you follow approach #2, would you feel adding default values in the code more (or less) maintainable? You could theoretically have a mix of both approaches as well. For example, doing datafix for what you consider to be essential fields that must stay consistent across the whole collection, and doing codefix for things not deemed to be essential. Note that MongoDB supports either approach without any issue.
You may want to browse the following links for more information:
Best regards,
Kevin
thanks Kevin,