ITPub博客

首页 > 数据库 > NoSQL > mongodb

mongodb

原创 NoSQL 作者:傻子329003748 时间:2015-12-01 13:34:37 0 删除 编辑

点击(此处)折叠或打开

  1. 3.查询
  2. 3.1查询表的所有记录
  3. 在oracle中使用
  4. select xuehao,name,tel from table2;
  5. 在mongodb里使用
  6. db.table2.find()
  7. 3.2查询指定的列的所有数据
  8. 在oracle中使用
  9. select name from table2;
  10. 在mongodb里使用
  11. db.table2.find({},{"name":1})
  12. 3.3查询过滤单一条件
  13. 在oracle中使用
  14. select xuehao,name,tel from table2 where xuehao="5";
  15. 在mongodb里使用
  16. db.table2.find({"xuehao":"5"},{"xuehao":1,"name":1,"tel":1})
  17. 3.4查询过滤多个组合and条件
  18. 在oracle中使用
  19. select xuehao,name,tel from table2 where xuehao="5" and name="lxd3";
  20. 在mongodb里使用
  21. db.table2.find({"xuehao":"5","name":"lxd3"},{"xuehao":1,"name":1,"tel":1})
  22. 3.5查询过滤多个组合or条件
  23. 在oracle中使用
  24. select xuehao,name,tel from table2 where xuehao="5" or name="lxd%";
  25. 在mongodb里使用
  26. db.table2.find({$or:[{"xuehao":"5","name":"/^lxd/"}]},{"xuehao":1,"name":1,"tel":1})


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29146891/viewspace-1850458/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Oracle 分析函数
下一篇: mysql参数
请登录后发表评论 登录
全部评论

注册时间:2015-07-10

  • 博文量
    7
  • 访问量
    33235