Logic

<< Click to Display Table of Contents >>

Current:  Create Calculated Field > Mongo Calculated Field Functions List 

Logic

Previous pageReturn to chapter overviewNext page

Functions

Syntax

Instructions

Examples

and

{ $and: [ <expression1>, <expression2>, ... ] }

Evaluates one or more expressions and returns true if all of the expressions are true or if evoked with no argument expressions. Otherwise, $and returns false.

For example:

{ $and: [ 1, true ] }

eq

{ $eq: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the values are equivalent,false when the values are not equivalent.

For example:

{ $eq: [ "$col", 250 ] }

gt

{ $gt: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the first value is greater than the second value,false when the first value is less than or equivalent to the second value.

For example:

{ $gt: [ "$col", 250 ] }

gte

{ $gte: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the first value is greater than or equivalent to the second value,false when the first value is less than the second value.

For example:

{ $gte: [ "$col", 250 ] }

lt

{ $lt: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the first value is less than the second value,false when the first value is greater than or equivalent to the second value.

For example:

{ $lt: [ "$col", 250 ] }

lte

{ $lte: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the first value is less than or equivalent to the second value,false when the first value is greater than the second value.

For example:

{ $lte: [ "$col", 250 ] }

ne

{ $ne: [ <expression1>, <expression2> ] }

Compares two values and returns:true when the values are not equivalent,false when the values are equivalent.

For example:

{ $ne: [ "$col", 250 ] }

not

{ $not: [ <expression> ] }

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.

For example:

{ $not: [ true ] }

or

{ $or: [ <expression1>, <expression2>, ... ] }

Evaluates one or more expressions and returns true if any of the expressions are true. Otherwise, $or returns false.

For example:

{ $or: [ true, false ] }