Hi guys, I’m trying to implement inner join using LINQ, but I’m getting “$project or $group does not support {document}.”
What I need to do is join the customer for each location
customers
{
{
"name": "customer 1",
"locations": [
{ "locationId": "1" },
{ "locationId": "2" },
{ "locationId": "3" }
]
},
{
"name": "customer 2",
"locations": [
{ "locationId": "1" },
{ "locationId": "3" }
]
}
}
locations
{
{
"additionalInformation": "some info"
"locationId": "1"
},
{
"additionalInformation": "some info"
"locationId": "2"
}
{
"additionalInformation": "some info"
"locationId": "3"
}
}
(from c in _mongoContext.Customers.AsQueryable()
from location in c.Locations
join l in _mongoContext.Locations on location.LocationId equals l.LocationId
select new LocationSummery
{
CustomerName = c.BusinessName,
AdditionalInformation= location.AdditionalInformation,
})