Indexing on mongodb

how to make mongodb index on query which contains lookup

Hi @harsh_sharma,

Welcome to MongoDB community

Its hard to give specific recommendations without seeing the query discussed, but general one is to index all fields in previous to the lookup $match or $sort stages. In orderof fields from Equility , Sort and Finally Range.

The last field/s should be the field used in source collection for lookup.
The target collection fields used to join should be indexed as well.