MongoDB 5.0.1 Correlated Subqueries Using Concise Syntax

The new MongoDB 5.0 should support the new lookup with foreignField, localField and pipeline as described here: https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#std-label-lookup-syntax-concise-correlated-subquery

No matter if I try to use this in Go library, Compass or directly through shell I always get $lookup with 'pipeline' may not specify 'localField' or 'foreignField'

Is anybody else experiencing the same problem?

I fixed the problem.

I migrated from MongoDB 4.4 to 5.0.1 and did not know about setFeatureCompatibilityVersion command. After setting the version to 5 everything works as expected.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.