MongoDB Documentation, Release 3.0.4 Name Description $setEquals Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions. $setIntersection Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions. $setUnion Returns a set with elements that appear in any of the input sets. Accepts any number of argument expressions. $setDifference Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement 20 of the second set relative to the first. Accepts exactly two argument expressions. $setIsSubset Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset$^{21}$. Accepts exactly two argument expressions. $anyElementTrue Returns true if any elements of a set evaluate to true ; otherwise, returns false . Accepts a single argument expression. $allElementsTrue Returns true if no element of a set evaluates to false , otherwise, returns false . Accepts a single argument expression. Comparison Expressions Comparison expressions return a boolean except for $cmp which returns a number. The comparison expressions take two argument expressions and compare both value and type, using the specified BSON comparison order (page 179) for values of different types. Arithmetic Expressions Arithmetic expressions perform mathematic operations on numbers. Some arithmetic ex- pressions can also support date arithmetic. String Expressions String expressions, with the exception of $concat , only have a well-defined behavior for strings of ASCII characters. $concat behavior is well-defined regardless of the characters used. Chapter 7. Aggregation 472 $^{20}$http://en.wikipedia.org/wiki/Complement_(set_theory) $^{21}$http://en.wikipedia.org/wiki/Subset Name Description $add Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date. $subtract Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number. $multiply Multiplies numbers to return the product. Accepts any number of argument expressions. $divide Returns the result of dividing the first number by the second. Accepts two argument expressions. $mod Returns the remainder of the first number divided by the second. Accepts two argument expressions. Name Description $cmp Returns: 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second. $eq Returns true if the values are equivalent. $gt Returns true if the first value is greater than the second. $gte Returns true if the first value is greater than or equal to the second. $lt Returns true if the first value is less than the second. $lte Returns true if the first value is less than or equal to the second. $ne Returns true if the values are not equivalent.