Mongodb 如何使用嵌套和&;或

Mongodb 如何使用嵌套和&;或,mongodb,mongoose,Mongodb,Mongoose,在mongodb中创建包含OR和条件的查询的正确方法是什么。 这是一个我尝试但没有成功的例子。 根据代码示例中的行注释 例如: { "$or": [ { "$and": [ { "type": { "$in": ["image/png", "image/jpg", "image/jpeg", "image/gif"]

在mongodb中创建包含OR和条件的查询的正确方法是什么。 这是一个我尝试但没有成功的例子。 根据代码示例中的行注释

例如:

    {
    "$or": [
        {
            "$and": [
                {
                    "type": {
                        "$in": ["image/png", "image/jpg", "image/jpeg", "image/gif"]
                    }
                }, {
                    // Why this condition produces a MongoError
                    "$or": {
                        "_account": "526fcb177675f27140000001",
                        "shared": true
                    }
                }
            ]
        }, {
            "$and": [
                {
                    "type": {
                        "$in": ["video/mov"]
                    }
                }, {

                    "_account": "526fcb177675f27140000001"
                }
            ]
        }
    ]
}
因为将数组作为参数:

"$or": [
         { "_account": "526fcb177675f27140000001" },
         { "shared": true }
]

谢谢。正是我想要的(不知道只接受数组)
"$or": [
         { "_account": "526fcb177675f27140000001" },
         { "shared": true }
]