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

Change in behaviour of parsing nested .Any predicates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.8.1
    • Component/s: Linq
    • Labels:
      None
    • Backwards Compatibility:
      Major Change

      Description

      Hello

      I have 2 classes:

      public class Donation    

      {                public ObjectId Id \{ get; set; }
              public ICollection<Item> Items { get; set; }

      }

      public class Item    
      {                public ObjectId Id { get; set; }

              public ICollection<ObjectId> ParentIds { get; set; }

      }

      Example Data:

      {   

           "_id" : ObjectId("553682b4ecab640ee4ba35e5"),       

           "Items" : [        

                             

      {     "_id" : ObjectId("553682b4ecab640ee4ba35e6"),                              "ParentIds" : [                                                     ObjectId("55368285ecab640eb8d6976f"),                                     ObjectId("55368256ecab640eb8d6976e"),                                      ObjectId("55016c84b9e76f04a8821be5")                                          ]                              }

          ]}

       

      I have the following c# predicate:
      find(x => x.Items.Any(d => d.ParentIds.Any(p => p == ObjectId("55368256ecab640eb8d6976e"))))

       

      V2.7.3 behaviour emits:

      .find({ "Items.ParentIds" : ObjectId("55368256ecab640eb8d6976e") })

       

      V.2.8.0 behaviour emits:

      .find({ "Items.ParentIds" : { "$elemMatch" :

      { "" : ObjectId("55368256ecab640eb8d6976e") }

      } })

       

      This breaks our production build, working happily for several years now....

       

      Thanks

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmitry.lukyanov Dmitry Lukyanov
              Reporter:
              kevin.fairs@neighbourly.com Kevin Fairs
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: