Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <condition> ::= <expression> | <expression-list>
- <expression> ::= { <field> : { <comparison-operator> : <value> } }
- <expression-list> ::= { <boolean-operator> : [ <condition> , <condition> {, <condition>} ] }
- <pair-comparison> ::= { <field> : { <comparison-operator> : <value> } }
- <array-comparison> ::= { <field> : { $in : [ <value> {, <value>} ] } }
- <comparison-operator> ::= $eq | $neq | $lt | $lte | $gt | $gte
- <boolean-operator> ::= $and | $or
- <field> ::= <text>
- <value> ::= <text> | <number>
- /****
- * Some examples.
- ****/
- // `name` = 'Sam'
- {name: {$eq: 'Sam'}}
- // `age` > 21
- {age: {$gt: 21}}
- // `showSize` IN (10, 10.5, 11)
- {shoeSize: {$in: [10, 10.5, 11]}}
- // (`name` = 'Sam' AND `age` > 21 AND showSize IN (10, 10.5, 11))
- {$and: [{name: {$eq: 'Sam'}}, {age: {$gt: 21}}, {shoeSize: {$in: [10, 10.5, 11]}}]}
- // (`name` = 'Sam' AND (`age` > 21 OR showSize IN (10, 10.5, 11)))
- {$and: [{name: {$eq: 'Sam'}}, {$or: [{age: {$gt: 21}}, {shoeSize: {$in: [10, 10.5, 11]}}]}]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement