表达式
<field1_name> <mathematical_operator> <value>
age字段值加一
取集合中age字段,age值加1
- > db.exec( "select age + 1 from foo.bar" )
- {
- }
比较表达式
<field1_name> <comparison_operator> <value> <> <field1_name> <comparison_operator> <value>
- age字段大于11
查询匹配age大于11的记录。
- > db.exec( "select * from foo.bar where age > 11" )
- {
- "_id": {
- "$oid": "5aa3330fdc5673331f000000"
- },
- "name": "Lucy",
- }
- age字段大于等于11,且name为Harry
- > db.exec( "select * from foo.bar where age >= 11 AND name = 'Harry'" )
- {
- "_id": {
- "$oid": "5aa35dbedc5673331f000001"
- },
- "name": "Harry",
- }