MongoVUE

对应成语句,结构如下:

db.logs.find({ "message" : /消息/ }, { "message" : 1 }).limit(50).sort({ "timestamp" : -1 });

现有学生表(姓名,年龄,时间)

create table student
(
NAME VARCHAR2(100),
AGE NUMBER(2),
CREATETIME TIMESTAMP(6)
)

1. 检索全部

select * from student

db.student.find({ });

2. 检索某些字段(0:不存在,1:存在),存在模式下只显示指定的字段,不存在模式下不显示指定的字段

select name from student

db.student.find({ }, { "name" : 0 })

3.排序(-1:desc, 1:asc)

select * from student order by age desc

db.student.find({ }).sort({ "age" : -1 });

4.值等

select * from student where name='小明'

db.student.find({ "name" : "小明" });

5.like

select * from student where name like '%旭%'

db.student.find({ "name" : /旭/ });

6.and

select * from student where name like '%旭%' and age =22

db.student.find({ "name":/旭/,"age":22});

7.or

select * from student where name like '%旭%' or age=22

db.student.find({ "$or" : [{ "name" : /旭/ }, { "age" : 22 }] });

8.<, <=, >, >= ($lt, $lte, $gt, $gte )

select * from student where age >=18 and age <=20

db.student.find({ "age" : { "$gte" : 18,"$lte" : 20 } });

9. 日期比较大小(Mongodb 中 Type 为 DateTime)

select * from student where createtime >= to_date('2015-06-01 10:10:10','YYYY-MM-DD HH24:MI:SS')

db.student.find({"createtime":{"$gte":ISODate("2015-06-01T10:10:10Z")}});

ps:中国+8 时区,mongodb 0 时区 (db)

查询时要以0时区为准(+8时间-8小时)

mongo find的更多相关文章

  1. 谈一谈NOSQL的应用,Redis/Mongo

    1.心路历程 上年11月份来公司了,和另外一个同事一起,做了公司一个移动项目的微信公众号,然后为了推广微信公众号,策划那边需要我们做一些活动,包括抽奖,投票.最开始是没有用过redis的,公司因为考虑 ...

  2. MongoDB分组汇总操作,及Spring data mongo的实现

    转载请在页首注明作者与出处 一:分组汇总 1.1:SQL样例 分组汇总的应用场景非常多,比如查询每个班级的总分是多少,如果用关系形数据库,那么sql是这样子的 ),class from score g ...

  3. mongo DB for C#

    (1)Download the MongoDB C#驱动. http://www.nuget.org/packages/mongocsharpdriver/. (2) Add Reference to ...

  4. Mongo基础使用,以及在Express项目中使用Mongoose

    MongoDB的基本使用 MongoDB特点: 使用BSON存储数据 支持相对丰富的查询操作(相对其他nosql数据库) 支持索引 副本集(支持多个实例/多个服务器运行同个数据库) 分片(数据库水平扩 ...

  5. 【mongo】mongoVUE使用

    1.查询存在字段"test"的项 {"test":{$exists:true}} 2.在表中插入字段 {$set:{"}} 3.正则匹配 {" ...

  6. mongo遍历表

    $mongo = new MongoClient("mongodb://192.168.8.189:27017"); $collectObj = $mongo->select ...

  7. python & mongo问题记录

    背景介绍 使用python操作mongo进行的一些操作记录,为了方便日后可以快速的解决类似问题. 准备工作 为了尽可能简单的说明,我将插入几条简单的数据. from pymongo import Mo ...

  8. Lind.DDD.Repositories.Mongo层介绍

    回到目录 之前已经发生了 大叔之前讲过被仓储化了的Mongodb,而在大叔开发了Lind.DDD之后,决定把这个东西再搬到本框架的仓储层来,这也是大势所趋的,毕竟mongodb是最像关系数据库的NoS ...

  9. MongoDB基础入门003--使用官方驱动操作mongo,C#

    本篇先简单介绍一下,使用官方驱动来操作MongoDB.至于MongoDB原生的增删改查语句,且等以后再慢慢学习. 一.操作MongoDB的驱动主要有两个 1.官方驱动:https://github.c ...

  10. mongo DB的一般操作

    最近接触了一些mongoDB .将一些指令操作记录下来,便于查询和使用 登录 [root@logs ~]# mongo -u loguser -p log123456 --authentication ...

随机推荐

  1. vmware克隆linux网络配置

    一.配置Linux网络 在安装Linux的时候,一定要保证你的物理网络的IP是手动设置的,要不然会在Linux设置IP连通网络的时候会报network is unreachable 并且怎么也找不到问 ...

  2. 删除TFS项目上的文件

    1.用vs(版本)开发人员命令提示输入命令进行删除 1.

  3. [转]MVC 分页

    本内容代码段抄自传智视频 /// <summary> /// 数据库分页 /// </summary> static List<dynamic> GetPageLi ...

  4. Map和Bean的相互转换

    Map和Bean的相互转换 BeanUtils位于org.apache.commons.beanutils.BeanUtils下面,其方法populate的作用解释如下: 完整方法: BeanUtil ...

  5. CSS布局模型学习

    转自:http://www.cnblogs.com/erliang/p/4092192.html CSS布局模型学习   参考链接慕课网:HTML+CSS基础课程 知识基础 1. 样式 内联 嵌入 外 ...

  6. 第11课 Qt中的字符串类

    1. 历史遗留问题和解决方案 (1)历史遗留问题 ①C语言不支持真正意义上的字符串 ②C语言用字符数组和一组函数实现字符串操作 ③C语言不支持自定义类型,因此无法获得字符串类型 (2)解决方案 ①从C ...

  7. uva-10815-字符串排序

    又偷懒了,字符串排序,贱贱的用了std:map #include <iostream> #include <sstream> #include<algorithm> ...

  8. 合并SCVMM虚拟机的差异磁盘,并删除那些难以删除的Checkpoints(Shapshots)

    使用Microsoft Data Protection Manager(DPM)有时会造成虚拟机的动态和固定磁盘变成差异磁盘,这个应该与DPM进行差异备份有关,未知原因造成DPM差异备份后无法复原原来 ...

  9. Javascript typeof 用法

    在js里用到数组,比如 多个名字相同的input, 若是动态生成的, 提交时就需要判断其是否是数组. if(document.mylist.length != "undefined" ...

  10. Delphi7 [Fatal Error] ClassPas.pas(8): File not found: 'DesignIntf.dcu'

    Delphi7 [Fatal Error] ClassPas.pas(8): File not found: 'DesignIntf.dcu' Add path to Project>Optio ...