小记------mongodb数据库如何进行模糊查询

// 模糊匹配createTime   是以 2019-07-23 开头
db.getCollection('driver_online_record').find({"createTime" : /^2019-07-23/})
 
// 模糊匹配createTime   包含 2019-07-23
db.getCollection('driver_online_record').find({"createTime" : /2019-07-23/})
 
// 模糊匹配createTime   是以 2019-07-23 结尾
db.getCollection('driver_online_record').find({"createTime" : /2019-07-23^/})
 
// 模糊匹配createTime   包含aaa  切忽略大小写
db.getCollection('driver_online_record').find({"createTime" : /aaa/i})

猜你喜欢

转载自www.cnblogs.com/yzqyxq/p/11317075.html
今日推荐