Q64 [Scenario]: Creating a new index on a 100M document collection causes production write timeouts. How do you create indexes safely?
In modern MongoDB (4.2+), indexes are built using an optimized hybrid build process that allows concurrent reads/writes. However, on massive collections, perform rolling index builds across replica set members: take Secondary nodes offline one by one, create the index locally, bring them back online, and finally step down the Primary node to build the index on it.
Key Takeaways
MongoDB 4.2+ uses hybrid index builds concurrently.
Use rolling index builds across replica sets for critical production databases.
Knowledge Check
What index creation strategy builds indexes on secondary nodes one by one to protect production workloads?