Skip to content

$gt

Returns true when the first expression evaluates greater than the second.

Syntax

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

Example

Input

{ "temperature": 31 }

Stage

{ "$project": { "isHot": { "$gt": ["$temperature", 30] } } }

Output

{ "isHot": true }