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.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1, 2.1
    • Component/s: Linq
    • Labels:
      None
    • Sprint:
      C# Sprint 19

      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

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

              Dates

              Created:
              Updated:
              Resolved: