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

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc1025
Components
Server components related to this issue

No components specified.

Labels
Tags and classification

No labels assigned.