Literal Operators

OperatorDescriptionExample
$literalAllows the insertion of any literal value. This is used mainly when you'd like to use a value that would otherwise be evaluated as an expression.pricesEqual: [{ $eq: [ "$cashValue", { $literal: "$10" } ] }]
$stringAllows the insertion of a string literal. The value must be a string or an expression that evaluates to a string.[{"$concat": ["c_pants", {"$string": "c_pants"}] } -> "clown c_pants"
$numberAllows the insertion of a number value as a literal where a property name would otherwise be expected. The value must be a number or an expression that evaluates to a number.[{"$add": ["c_scalar", {"$number": 1.23}] }]
$integerAllows the insertion of an integer value as a literal where a property name would otherwise be expected. The value must be an integer or an expression that evaluates to an integer.[{"$add": ["c_ints", {"$integer": 10}] }]
$booleanAllows the insertion of a boolean value as a literal where a property name would otherwise be expected. The value must be a boolean or an expression that evaluates to a boolean.[{"alwaysFirstName": {"$first": {"$cond": [{"$boolean": true}, "name.first", "name.last"]}}]
$dateAllows the insertion of a date value as a literal where a property name would otherwise be expected. The value must be a date or an expression that evaluates to a date.[{"offsetDate": {"$add": [{"$date": "2015-06-07T14:48:00.000Z"}, "c_offset"]}]
$objectIdAllows the insertion of an objectId value as a literal where a property name would otherwise be expected. The value must be an objectId or an expression that evaluates to an objectId.[{"$cmp": [{"$objectId": "561614700000000000000000"}, "_id"]}]
$arrayAllows the insertion of an array value as a literal where a property name would otherwise be expected. The value must be an array or an expression that evaluates to an array.[{"$setUnion": [{"$array": ["000000000000000000000007"]}, "roles"]}]
$objectAllows the insertion of an object value as a literal where a property name would otherwise be expected. The value must be an object or an expression that evaluates to an object.[{"$eq": [{"$object": {
"street": "Easy St"
}}, "c_address"]}]