+2 votes
in Mean Stack by
What purpose do Indexes serve in MongoDB?

1 Answer

0 votes
by
In MongoDB, indexes are used to support and facilitate the efficient execution of queries. Without indexes, MongoDB has to perform a collection scan wherein it has to scan every document in a collection and select the appropriate documents that match the query statement. However, if each query has an appropriate index assigned to it, MongoDB can use the index to limit the number of documents it has to inspect.

Related questions

0 votes
+1 vote
asked Nov 21, 2021 in MongoDB by DavidAnderson
0 votes
asked Jan 7, 2023 in MongoDB by sharadyadav1986
...