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

Optimize { $expr : true } to { }

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.15.1
    • Affects Version/s: None
    • Component/s: LINQ3
    • None
    • Fully Compatible

      Consider the following LINQ:

      var dog1 = "dog";
      var dog2 = "dog";
      var query = coll.AsQueryable().Where(x => dog1 == dog2);
      

      This will render the following MQL because we know client-side at runtime that the expression evaluates to true.

      [ { $match : { $expr : true } }]
      

      We should optimize this to the equivalent and faster:

      [ { $match : { } }]
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: