Given two simple collections:
class Person { public string Id { get; set; } public string Name { get; set; } public IEnumerable<string> PetIds { get; set; } } class Pet { public string Id { get; set; } public string Name { get; set; } public string Type { get; set; } }
The following query throws an exception:
var peopleCollection = db.GetCollection<Person>("people").AsQueryable(); var petCollection = db.GetCollection<Pet>("pets").AsQueryable(); var query = from person in peopleCollection from petId in person.PetIds join pet in petCollection on petId equals pet.Id into pets select new {person, pets} ;
Exception thrown: 'System.NotSupportedException' in MongoDB.Driver.dll
An unhandled exception of type 'System.NotSupportedException' occurred in MongoDB.Driver.dll
$project or $group does not support {document}.
Note: that the compound From (FROM FROM) and the JOIN both work without an exception when used alone, but an exception is thrown when they are used together.