$where $options: 'g','i'

db.classes.update({"count":{$gt:20}},{$set:{"name":"c4"}},false,false) 存在更新一条记录,不存在不插入upsert,multi
db.classes.update({"count":{$gt:20}},{$set:{"name":"c4"}},false,true) 存在更新多条记录,不存在不插入
db.classes.update({"count":{$gt:20}},{$set:{"name":"c4"}},true,false) 存在更新一条记录,不存在插入
db.usercollection.find({name: {$exists: true}, $where: "this.name.length > 40"}).limit(2);
db.apps.find({$where:"(this.id.length gt 6) && (this.id.length lt 15) " } ).count();

db.table1.find({$where:'this.a == this.b'})
$regex: 'Value_2', $options: 'g' }

原文地址:https://www.cnblogs.com/jayruan/p/5161796.html