📜  thatstamil - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:43.897000             🧑  作者: Mango

代码示例1
db.test.aggregate([
    // Get just the docs that contain a shapes element where color is 'red'
    {$match: {'shapes.color': 'red'}},
    {$project: {
        shapes: {$filter: {
            input: '$shapes',
            as: 'shape',
            cond: {$eq: ['$$shape.color', 'red']}
        }},
        _id: 0
    }}
])