First and Last accumulators should thrown an exception when used with a predicate.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 2.0.1, 2.1
    • Affects Version/s: 2.0
    • Component/s: LINQ
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Since MongoDB doesn't support predicates inside the $first and $last operators, we should throw a not supported exception.

      
      var list = await collection.Aggregate()
          .Group(x => x.Name, g => new { Key = g.Key, FavoritePet = g.Pets.First(x => x.Name == "Fluffy") })
          .ToListAsync();
      
      

      Currently, I believe the predicates are getting dropped when we rewrite First/Last calls

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

              Created:
              Updated:
              Resolved: