表达式

    <field1_name> <> <value>

    age字段值加一

    取集合中age字段,age值加1

    1. > db.exec( "select age + 1 from foo.bar" )
    2. {
    3. }

    比较表达式

    <field1_name> <comparison_operator> <value> <> <field1_name> <comparison_operator> <value>

    • age字段大于11

    查询匹配age大于11的记录。

    1. > db.exec( "select * from foo.bar where age > 11" )
    2. {
    3. "_id": {
    4. "$oid": "5aa3330fdc5673331f000000"
    5. },
    6. "name": "Lucy",
    7. }
    • age字段大于等于11,且name为Harry
    1. > db.exec( "select * from foo.bar where age >= 11 AND name = 'Harry'" )
    2. {
    3. "_id": {
    4. "$oid": "5aa35dbedc5673331f000001"
    5. },
    6. "name": "Harry",
    7. }