美文网首页
mongodb 常用不好写命令整理

mongodb 常用不好写命令整理

作者: 小武子 | 来源:发表于2015-10-27 11:08 被阅读38次
  • select * from db.co order by id DESC limit 5
 db.co.find().limit(5).sort({"_id":-1})
  • find some items not exists in collection:
    db.co.find({ "item":
            { "$exists" : False }
        })
  • skip
db.co.find().skip(5).limit(5)
  • delete from db.co where age < 30
db.co.remove({ 'age' : {$lt : 30}})
  • select age from db.co
db.co.find({},{"age" : 1})
  • select others(not age) from db.co
db.co.find({},{"age" : 0})

相关文章

网友评论

      本文标题:mongodb 常用不好写命令整理

      本文链接:https://www.haomeiwen.com/subject/wduxhttx.html