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. 如何写django中form的测试用例

    可简可繁, 可插库,可字符, 要测试valid,也要测试invalid, 可用csrf,也可用context. 放一个全面的, 实践中,找一个最优的组合就好. class NewTopicTests( ...

  2. weex官方demo weex-hackernews代码解读(上)

    一.介绍 weex 是阿里出品的一个类似RN的框架,可以使用前端技术来开发移动应用,实现一份代码支持H5,IOS和Android.最新版本的weex已默认将vue.js作为前端框架,而weex-hac ...

  3. 【AtCoder】AGC021

    A - Digit Sum 2 从高位到低位数的第i位以前前缀都相同,第i位比当前位上的数小1的情况下,后面都填9 枚举一下然后计算最大的就好 #include <bits/stdc++.h&g ...

  4. 7-11Zombie's Treasure Chest uva12325

    题意  你有一个体积为N的箱子和两种数量无限的宝物  宝物1的体积为s1 价值为v1   宝物2同理 输入均为32位带符号整数 你的任务是计算最多能带走多少价值的宝物 暴力枚举: 首先明白一点     ...

  5. 025.Zabbix之SNMP监控

    一 SNMP介绍及配置 1.1 SNMP介绍参考其他笔记 1.2 SNMP配置 [SW1]int vlan 1 [SW1-Vlanif1]ip address 172.24.8.13 24 [SW1- ...

  6. Parcel极速零配置Web应用打包工具

    当听到极速零配置打包,我不经兴奋起来,零配置!!!想起在webpack打包的配置,这个零配置着实让我好奇不已,迅速学习一波. Parcel(parcel 英[ˈpɑ:sl] 美[ˈpɑ:rsl])有以 ...

  7. SpringMVC框架04——RESTful入门

    1.RESTful的基本概念 REST(Representational State Transfer)表述性状态转移,REST并不是一种创新技术,它指的是一组架构约束条件和原则,符合REST的约束条 ...

  8. 51nod 1584加权约数和

    学到了好多东西啊这题... https://blog.csdn.net/sdfzyhx/article/details/72968468 #include<bits/stdc++.h> u ...

  9. BZOJ4161 常系数齐次线性递推

    问了数竞的毛毛搞了一番也没太明白,好在代码蛮好写先记下吧. #include<bits/stdc++.h> using namespace std; ,mod=1e9+; int n,k, ...

  10. Codeforces.810D.Glad to see you!(交互 二分)

    题目链接 \(Description\) 有一个大小为\(k\)的集合\(S\),元素两两不同且在\([1,n]\)内.你可以询问不超过\(60\)次,每次询问你给出\(x,y\),交互库会返回\(\ ...