mongo sql 说明
db.users.find() select * from users 从user表中查询所有数据
db.users.find({“username” : “joe”, “age” : 27}) select * from users where “username” = “joe” and age = 27 查找username = joe且age = 27的人
db.users.find({}, {“username” : 1, “email” : 1}) select username, email from users 查找username,email这2个子项
db.users.find({“age” : {“$gt” : 18}}) select * from users where age >18 查找age > 18的会员
db.users.find({“age” : {“$gte” : 18}}) select * from users where age >=18 查找age >= 18的人
db.users.find({“age” : {“$lt” : 18}}) select * from users where age <18 查找age < 18的人
db.users.find({“age” : {“$lte” : 18}}) select * from users where age <=18 查找age <= 18的人
db.users.find({“username” : {“$ne” : “joe”}}) select * from users where username <> “joe” 查找 username != joe的会员
db.users.find({“ticket_no” : {“$in” : [725, 542, 390]}}) select * from users where ticket_no in (725, 542, 390) 符合tickt_no在此范围的结果
db.users.find({“ticket_no” : {“$nin” : [725, 542, 390]}}) select * from users where ticket_no not in (725, 542, 390) 符合tickt_no不在此范围的结果
db.users.find({“name” : /joey^/}) select * from users where name like “joey%” 查找前4个字符为joey的人

mongodb常用查询的更多相关文章

  1. mongodb常用查询语法

    一.查询 find方法 db.collection_name.find(); 查询所有的结果: select * from users; db.users.find(); 指定返回那些列(键): se ...

  2. MongoDB常用查询,排序,group,SpringDataMongoDB update group

    MongoDB查询 指定查询并排序 db.getCollection('location').find({"site.id":"川A12345","s ...

  3. MongoDB 常用查询语法

    一.查询 find方法 db.collection_name.find(); 查询所有的结果: select * from users; db.users.find(); 指定返回那些列(键): se ...

  4. mongodb常用查询语句

    1.查询所有记录db.userInfo.find();相当于:select* from userInfo; 2.查询去掉后的当前聚集集合中的某列的重复数据db.userInfo.distinct(&q ...

  5. mongodb常用查询语句(转)

    1.查询所有记录 db.userInfo.find();相当于:select* from userInfo; 2.查询去掉后的当前聚集集合中的某列的重复数据db.userInfo.distinct(& ...

  6. 记录MongoDB常用查询

    {$and:[{"}}]} // flag不等于1 也不等于0 {$or:[{"flag" :{ $ne:"1"}},{"flag" ...

  7. MongoDB常用操作一查询find方法db.collection_name.find()

    来:http://blog.csdn.net/wangli61289/article/details/40623097 https://docs.mongodb.org/manual/referenc ...

  8. MongoDB常用操作一查询find方法(转)

    来:http://blog.csdn.net/wangli61289/article/details/40623097 https://docs.mongodb.org/manual/referenc ...

  9. TODO:MongoDB的查询更新删除总结

    TODO:MongoDB的查询更新删除总结 常用查询,条件操作符查询,< .<=.>.>=.!= 对应 MongoDB的查询操作符是$lt.$lte.$gt.$gte.$ne ...

随机推荐

  1. Notes for building gimp-print

    First try, build gimp-print on ubuntu. 1. Install all dependencies. sudo apt-get install libcups2-de ...

  2. MATLAB遍历文件夹下所有文件

    先给出函数 function [ files ] = scanDir( root_dir ) files={}; if root_dir(end)~='/' root_dir=[root_dir,'/ ...

  3. 利用HTML5定位功能,实现在百度地图上定位(转)

    原文:利用HTML5定位功能,实现在百度地图上定位 代码如下: 测试浏览器:ie11定位成功率100%,Safari定位成功率97%,(add by zhj :在手机上测试(用微信内置浏览器打开),无 ...

  4. 004.LVM缩减

    一 缩减步骤 卸载挂载点 检查文件系统 调整分区大小 缩减LV大小 重新挂载并检查 注意: 1 减少文件的大小一定需要按照上面提高的4个规定动作顺序来做,在缩减LV大小前,首先要缩减filesyste ...

  5. poj-1459-最大流dinic+链式前向星-isap+bfs+stack

    title: poj-1459-最大流dinic+链式前向星-isap+bfs+stack date: 2018-11-22 20:57:54 tags: acm 刷题 categories: ACM ...

  6. Android 前台服务

    Android 前台服务 学习自 https://blog.csdn.net/guolin_blog/article/details/11952435#t3 前台服务漫谈 我们之前学习的Service ...

  7. bzoj 3285 离散对数解指数方程

    /************************************************************** Problem: 3285 User: idy002 Language: ...

  8. ios数据保存

  9. Java+Windows+ffmpeg实现视频转换

    最近由于项目需要,研究了一下如何用Java实现视频转换,“着实”废了点心思,整理整理,写出给自己备忘下. 思路 由于之前没有没法过相关功能的经验,一开始来真不知道从哪里入手.当然,这个解决,googl ...

  10. USBDM RS08/HCS08/HCS12/Coldfire V1,2,3,4/DSC/Kinetis Debugger and Programmer -- MC9S08JS16

    Introduction The attached files provide a port of a combined TBDML/OSBDM code to a MC9S08JS16 proces ...