Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-3723

Cannot use Linq JOIN after compound FROM clause

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Linq, LINQ3

      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.

       

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            dmannion@propractice.com David Mannion
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: