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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.0.1, 2.1
    • 2.0
    • Linq
    • None

    Description

      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

      Attachments

        Activity

          People

            craig.wilson@mongodb.com Craig Wilson
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: