zoukankan      html  css  js  c++  java
  • 小记------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})
     
    //查询userPaySum的值小于1000
    db.getCollection('evcs_order_info').find({userPaySum:{$lt:1000}})
     
    //查询userPaySum的值小于等于1000
    db.getCollection('evcs_order_info').find({userPaySum:{$lte:1000}})
     
    //查询userPaySum的值大于等于1000
    db.getCollection('evcs_order_info').find({userPaySum:{$gte:1000}})
     
    //查询userPaySum的值大于1000
    db.getCollection('evcs_order_info').find({userPaySum:{$gt:1000}})
     
    //查询userPaySum的值不等于1000
    db.getCollection('evcs_order_info').find({userPaySum:{$ne:1000}})
     
    //查询driverId为3306  , 按照createTime排序   值是-1  倒序  值为1 是正序
    db.getCollection('driver_listen_order_location_record_20200527').find({'driverId' : 3306}).sort({'createTime' : -1})
     
  • 相关阅读:
    Spring创建对象的原理
    java.io.WriteAbortedException异常
    在servlet中返回json数据
    Java中导入导出Excel -- POI技术
    Java文件下载
    MySql 分页关键字(limit)
    从dao层查出的数据到页面时数值都是零的异常
    注解
    事务的四大特性
    Java-事务管理
  • 原文地址:https://www.cnblogs.com/yzqyxq/p/11317075.html
Copyright © 2011-2022 走看看