How do I perform a $lookup with the MongoDB C# driver? I cannot find it in their driver doc here:
https://docs.mongodb.org/getting-started/csharp/query/
But if I understand this ticket in their JIRA correctly, it should be in the 2.2 version of the driver:
https://jira.mongodb.org/browse/CSHARP-1374
You can also achieve that using the collection.Aggregate().Lookup() method or by adding the lookup to the aggregate stages.
collection.Aggregate()
.Lookup("foreignCollectionName", "localFieldName", "foreignFieldName", "result");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With