- 
    Type:New Feature 
- 
    Resolution: Unresolved
- 
    Priority: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
- 
        (copied to CRM)
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
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.
- is duplicated by
- 
                    SERVER-10708 negation of query expressions using "$not" -         
- Closed
 
-         
- is related to
- 
                    JAVA-4006 Filters can produce invalid query shapes in Java 4.0+ -         
- Closed
 
-         
- 
                    SERVER-58772 improve error message for top level $not expression -         
- Closed
 
-         
- related to
- 
                    SERVER-39019 $elemMatch $ne serialization is incorrect, doesn't roundtrip -         
- Closed
 
-         
- 
                    SERVER-43349 Incorrect serialization for $elemMatch $not $ne -         
- Closed
 
-         
- 
                    JAVA-4008 Document JAVA-4006 in Driver Upgrade notes -         
- Closed
 
-