Just a small gotcha when You need to change your collection's schema in MongoDB. Basically, there are three general ways to go:
- Just keep inserting documents with the new schema and leave old records intact. This might be an issue working with statically typed languages like C#, though.
- Perform a bulk update on the existing documents.
- An adaptive approach, when You update old documents to the new schema one by one at an appropriate event (such as getting read from or written to).
Related Posts:
My Experience with MongoDB University Part 1: The Beginning
My Experience with MongoDB University Part 2: When Your Schema is changed