On this page本页内容
$cmp¶Compares two values and returns:比较两个值并返回:
-1 if the first value is less than the second.-1。1 if the first value is greater than the second.1。0 if the two values are equivalent.0。The $cmp compares both value and type, using the specified BSON comparison order for values of different types.$cmp使用不同类型的值的指定BSON比较顺序来比较值和类型。
$cmp has the following syntax:语法如下所示:
For more information on expressions, see Expressions.有关表达式的详细信息,请参阅表达式。