What is the big-o complexity of MongoDB lookup operation?
Say I have n records in my MongoDB collection 'A',
And n records in collection 'B', each B's document have foreign _id of A, and one specific tag eg "preOrder","directOrder", "pendingOrder" ...
case 1:
if I add match query on the collection 'A' with some filters and add lookup with B collection.
and I got resulted in an array of objects of B's data and I loop through each array of each object to performs some operation and count each tag's count
case 2:
Add match query on the collection 'A' with filter
loop through each result and query in the loop for match B's record
What will be the difference in time and load on the mongo server?