On this page本页内容
$not
¶Evaluates a boolean and returns the opposite boolean value; i.e. when passed an expression that evaluates to 计算布尔值并返回相反的布尔值;当传递一个计算结果为true
, $not
returns false
; when passed an expression that evaluates to false
, $not
returns true
.true
的表达式时,$not
返回false
;当传递一个计算结果为false
的表达式时,$not
返回true
。
$not
has the following syntax:语法如下所示:
For more information on expressions, see Expressions.有关表达式的详细信息,请参阅表达式。
In addition to the 除了假布尔值false
boolean value, $not
evaluates as false
the following: null
, 0
, and undefined
values. ,$not
的计算结果如下:null
、0
和undefined
的值。The $not
evaluates all other values as true
, including non-zero numeric values and arrays.$not
将所有其他值计算为true
,包括非零数值和数组。
Result | ||
---|---|---|
{ $not: [ true ] } |
false | |
{ $not: [ [ false ] ] } |
false | |
{ $not: [ false ] } |
true | |
{ $not: [ null ] } |
true | |
{ $not: [ 0 ] } |
true |