mongodb模糊查询
mongodb中模糊查询[*]方式1
[*]db.shop.find({"field_name": /value/})
[*]
[*]方式2
[*] db.shop.find({"shop_place":{$regex:"光谷",$options:"i"}},{"shop_name":1,"shop_id":1})
[*]db.shop.find({"shop_name":{$regex:/光谷.*/i}},{"shop_name":1,"shop_id":1})
pymongo中使用模糊查询
点击(此处)折叠或打开
[*]import pymongo
[*]db.shop.find({"shop_name":{"$regex": value},{"shop_name":1})
[*]方式2
[*]import re
[*]db.shop.find({"shop_name":re.compile(value))
参考:http://blog.csdn.net/whd0310/article/details/41895163
页:
[1]