mongo的基本命令使用

or的使用(查找title为123或者是345)

db.getCollection("news").find({
    $or: [{
        "title": "123"
    }, {
        
        "title": "345"
    }]
})

获取某些列(从news表中查找author为Staff Writer)

db.news.find({ author: "Staff Writer" }, { title: 1, content: 1 })
原文地址:https://www.cnblogs.com/lxz123/p/15457396.html