What purpose do indexes serve in MongoDB of mean stack?
Indexes utilised in MongoDB to support and expedite the effective execution of queries.
Without indexes, MongoDB must run a collection scan in
which it looks over each document in a collection and chooses the ones that best match the query.
However, MongoDB can use the index to reduce the number of documents it needs to inspect if each query given a suitable index.