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

LINQ should translate false bool expressions to {a : false} rather than {a : {$ne : true}}

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 1.6
    • None

    Description

      The following LINQ Expression:

      ...Where(d => !d.BoolField)

      Translates to {BoolField : {$ne : true.}} Well, this is not great for performance and the expression is not able to use an index as well as

      {BoolField : false}

      would be able to use the index.

      Since in the driver serialization, we know that the field will always be serialized to bool, it would be better to translate the expression to

      {BoolField : false}

      instead.

      (Note that (d => d.BoolField == false) appears to translate correctly.)

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            zaidmasud Zaid Masud
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: