Correlated Subqueries

I’m trying to perform a correlated subquery as described here: https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#perform-a-concise-correlated-subquery-with--lookup

I’m getting the following error: $lookup with 'pipeline' may not specify 'localField' or 'foreignField'

I’m on version 5.0.2, so according to the documentation, this should work. Is anyone else having a problem with this?

Thanks

Please share the exact $lookup you are doing. It is hard to tell what is wrong without seeing it.

Read Formatting code and log snippets in posts so it is easy for us to read and duplicate.

1 Like