小编Sha*_*nan的帖子

在mongodb聚合中查找

以下bson是personaddresscollection:

{ 
        "id" : "123456", 
        "name" : "foo", 
        "address" : [
            {
                "local" : "yes", 
                "location" : [
                   {
                        "place" : {
                            "_id":"VZG", 

                        }, 
                        "place_lat" : "18", 
                        "place_lan" : "83", 

                },
                {
                        "place" : {
                            "name" : "kerala", 
                            "district" : "palakkad", 
                            "pincode" : "5203689", 

                        }, 
                        "place_lat" : "18", 
                        "place_lan" : "83",      
                    }
                ]
            }
        ]
    } 
Run Code Online (Sandbox Code Playgroud)

我还有另一个places收藏:

 {
     "_id":"VZG",
     "name" : "vizag", 
     "district" : "Visakhaptanam, 
     "pincode" : "568923",
 }
Run Code Online (Sandbox Code Playgroud)

MongoDB中聚集使用查找,我想嵌入 places 在收集personaddress集合

我尝试使用

Aggregation …
Run Code Online (Sandbox Code Playgroud)

java spring-mvc mongodb mongodb-query aggregation-framework

4
推荐指数
1
解决办法
6009
查看次数