Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumMongoDB$lookup joinsSingle-choice MCQ

In a $lookup with a 'let' and 'pipeline', why can't you reference the joined collection's fields directly with $$ but must use $ for them?

{ $lookup: { from: "orders", let: { uid: "$_id" }, pipeline: [ { $match: { $expr: { $eq: [ "$userId", "$$uid" ] } } } ], as: "orders" }}