熬死你的 发表于 2018-10-25 07:12:27

mongoDB查询语句

  查询:
  db.mycoll.find()
  db.mycoll.find().pretty()
  db.mycoll.find({"title":"fcy"})-------------等于
  db.mycoll.find({"age":{$lt:30}})    ------小于
  db.mycoll.find({"age":{$lte:30}})    ----小于等于
  db.mycoll.find({"age":{$gt:30}})    -----大于
  db.mycoll.find({"age":{$gte:30}})    ---大于等于
  db.mycoll.find({"age":{$ne:30}})    ----不等于
  db.mycoll.find({"money":{$lt:80,$gt:50}})----小于80大于50的数据
  db.mycoll.find({"name":35,"title":"teacher"}) -----and
  db.mycoll.find({$or:[{"name":"Jerry"},{"age":23}]}) ----or
  db.mycoll.find().sort({"age":1}).limit(10) ----1为升序,-1为降序

页: [1]
查看完整版本: mongoDB查询语句