Using Dollar Projection operator works with expression trees but not with builders.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Using below 2 queries generate the same projection, but the results are different:

      // works
      collection.Find(x => x.Pets.Any(p => p.Name == "Jack")
          .Project(x => x.Pets.ElementAt(-1))
          .ToListAsync();
      
      // doesn't work
      collection.Find(x => x.Pets.Any(p => p.Name == "Jack")
          .Project(Builders<Person>.Projection.Include(p => p.Pets.ElementAt(-1)))
          .ToListAsync();
      

            Assignee:
            Craig Wilson
            Reporter:
            Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: