Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1454

Use $not as a top-level logical op

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization
    • v4.4, v4.2, v4.0
    • Query Optimization 2021-06-14, QO 2021-09-20, QO 2021-10-04, QO 2021-10-18, QO 2021-11-01, QO 2021-11-15, QO 2021-11-29, QO 2021-12-13, QO 2021-12-27, QO 2022-01-10, QO 2022-01-24, QO 2022-02-07, QO 2022-02-21, QO 2022-03-07

      In our MongoDB-CSharp driver we convert code expressions like that to documents queries.

      !(Address.IsDefault && Adress.Name=="foo")
      

      The problem here is that the ! operator reverses the meaning of both equality checks. This scenario would be much easier to accomplish when we could use the $not operator like the $or operator.

      Example:

      { $not : [ 
          { "Address.IsDefault" : true },
          { "Address.Name" : "foo" }
      ] }
      

      I think also that this is more the way the users expect to use the $not operator.

        1. top_level_not.patch
          3 kB
          Charlie Swanson

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            lanwin Steve Wagner
            Votes:
            17 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated: