Querying a Collection by a Match on an ID1-ID2 Collection

I’m having the darnest time trying to get a particular query right. It’s a fairly simple SQL query, but my searches online (Stack, Google, etc.) on how to do it with the C# Driver API is just evading me. If someone here can help me, it’d be much appreciated. Here’s my scenario:

Assuming I have the following 2 collections:

UserCars {
   UserId
   CarId
}
Cars {
   Id
   Make
   Model
   Name
}

I’d like to get all Cars where the UserId = X (using the join collection).

Thanks!

Can’t you call usercars and populate carid? sure, you’ll also get userid, but you can play with the structure of the data you get.

I know my solution isn’t the best, but it’s something. I’m not an expert.

i do not know how to express it in c# but you could use Compass to create the aggregation and then export it in c#

UserCars.aggregate

a match stage with UserId:X
a lookup stage from:Cars with localField:CarId and foreignField:Id