[CSHARP-3723] Cannot use Linq JOIN after compound FROM clause Created: 02/Jul/21  Updated: 17/Nov/22

Status: Backlog
Project: C# Driver
Component/s: Linq, LINQ3
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: David Mannion Assignee: Robert Stam
Resolution: Unresolved Votes: 0
Labels: triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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.

 



 Comments   
Comment by Esha Bhargava [ 02/Jul/21 ]

dmannion@propractice.comThank you for reporting the issue! We'll look into it and get back to you soon.

Generated at Wed Feb 07 21:46:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.