Suppose that after $match
stage, 10,000 documents will be passed into a $lookup
stage. For each of those 10,000 documents, the $lookup
will need to join based on its _id
. The foreign field to join by will be indexed and almost unique - as it is made up of _id
.
Will each $lookup
for each of the 10,000 documents have O(1) due to the index?
So is it safe to assume that this pipeline will be fast and scalable?