Optimize { $expr : true } to { }

XMLWordPrintableJSON

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

      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 Stam
              Reporter:
              James Kovacs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: