steevej
(Steeve Juneau)
2
Can you clarify the above? You so not have any field named region_id so it is not clear how you would filter by region_id:7777. The values 7777 and 8888 seems to be associated with a field named location_id. So I feel you sample documents are redacted from real documents.
Despite some information that is not clear what I think could work is
- Replace the $addFields at the top level by an inner pipeline in the $lookup that $match on location_id.
The updated $lookup would look like: