Indexes: speed vs write cost
createIndex builds B-tree indexes. Queries that match index prefix fly; collection scans do not.
Quirk: Too many indexes slow writes. Too few slow reads. Database tuning is a lifestyle.
Use explain("executionStats") to see if MongoDB used an index.
Output
Press Run to execute your code.