SERVER-127901ClosedFixed
(classic) Add a small foreign collection result cache to $lookup for repeat localField values
In classic $lookup, we query the foreign collection for each incoming localField value. This involves reconstructing and optimizing the foreign collection query for each new value. However often there are repeat localField values, which means the foreign query results will be the same if there are no let variables. We can have a small LRU cache for the previous localField values, and only store the results if they are small (a few kb). This is beneficial when the number of distinct localField