小编cha*_*hap的帖子

MongoDB计算数组和无限子数组中的所有对象

{
    "ArticleName": "Example Article",
    "Comments": [
        {
            "Text": "Great Article",
            "Responses": [
                {
                    "Text": "No it isnt",
                    "Responses": [
                        {
                            "Text": "Yes it is"
                        }
                    ]
                },
                {
                    "Text": "Spot on"
                }
            ]
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

每次出现的关键"文本"都会被视为注释(因此有4条评论).在Mongo中,最好的方法是什么?

arrays mongodb mongodb-query aggregation-framework

8
推荐指数
1
解决办法
143
查看次数