If you are doing an aggregation on a large collection, and your aggregation contains a $lookup stage which queries a smaller collection (think <= 100 documents), the $lookup stage will issue a query for each document in the larger collection.
The $lookup stage should cache the results of the query to avoid unnecessary work in situations like this.
I have tried the $lookup aggregator and the performance was not as expected.
I have one collection with about 350K documents and one with 100 documents.
There are two indexes on the “localfield” and on the “foreignfield”.
I am trying to join the first collection with the second.
After an exchange of emails with Norberto : "it looks like it is not using either indexes, and therefore it's taking so long. "
Please find above the link to test: