MongoDB Documentation, Release 3.0.4 Literals Expression Objects Operator Expressions 471 7.4. Aggregation Reference Set Expressions Set expressions performs set operation on arrays, treating arrays as sets. Set expressions ignores the duplicate entries in each input array and the order of the elements. If the set operation returns a set, the operation filters out duplicates in the result to output an array that contains only unique entries. The order of the elements in the output array is unspecified. If a set contains a nested array element, the set expression does not descend into the nested array but evaluates the array at top-level. Boolean Expressions Boolean expressions evaluate their argument expressions as booleans and return a boolean as the result. In addition to the false boolean value, Boolean expression evaluates as false the following: null , 0 , and undefined values. The Boolean expression evaluates all other values as true , including non-zero numeric values and arrays. To avoid parsing ambiguity if the argument is a literal array, you must wrap the literal array in a $literal expression or keep the outer array that designates the argument list. { <operator>: <argument> } If operator accepts a single argument, you can omit the outer array designating the argument list: { <operator>: [ <argument1>, <argument2> ... ] } Operator expressions are similar to functions that take arguments. In general, these expressions take an array of arguments and have the following form: If the expressions are numeric or boolean literals, MongoDB treats the literals as projection flags (e.g. 1 or true to include the field), valid only in the $project stage. To avoid treating numeric or boolean literals as projection flags, use the $literal expression to wrap the numeric or boolean literals. Expression objects have the following form: { <field1>: <expression1>, ... } Literals can be of any type. However, MongoDB parses string literals that start with a dollar sign $ as a path to a field and numeric/boolean literals in expression objects (page 471) as projection flags. To avoid parsing literals, use the $literal expression. Name Description $and Returns true only when all its expressions evaluate to true . Accepts any number of argument expressions. $or Returns true when any of its expressions evaluates to true . Accepts any number of argument expressions. $not Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression.