skip to content
Alvin Lucillo

Duplicate indexes

/ 1 min read

💻 Tech

If you have an existing compound index for a collection with fields ‘name’, ‘age’, and ‘address’, and you’re planning to add another compound index for fields ‘name’ and ‘age’, you don’t need to create the latter. This is because MongoDB already indexed the combination of ‘name’ and ‘age’ from an existing index. Creating the latter would be a redundant index.