Aggregate $match _id $eq $toObjectId not working

I found that:

{ $match: { $expr: { $eq: [ ‘$_id’, ‘$$imageId’ ] } } }

does work ($$imageId is an ObjectId used in the non-simplified aggregate). Maybe the { $eq: ‘$value’ } format does not work in pipelines.

2 Likes