mongodb操作符

1."$gt" 、"$gte"、 "$lt"、 "$lte"、"null查询"、"$all"、"$size"、"$in"、"$nin"、"$and"、"$nor"、"$not"、"$or"、"$exists"、"$mod"、"$regex"、"$where"、"$slice"、"$elemMatch"

2.要是想查询数组指定位置的元素,则需使用key.index语法指定下标

3. $and  :    db.getCollection('students').find({ $and: [ { name: "t1" }, { amount: { $lt:50 } } ] } )

4. $nor :       db.getCollection('students').find( { $nor: [ { name: "t1" }, { qty: { $lt: 50 } } ] } )

5. $or :  执行逻辑OR运算,指定一个至少包含两个表达式的数组,选择出至少满足数组中一条表达式的文档

 db.getCollection('students').find( { $or: [ { amount: { $gt: 50 } }, { name: "t1" } ] } )

猜你喜欢

转载自www.cnblogs.com/qiyc/p/9066174.html