MongoDB - 从参考对象获取嵌入数据

时间:2016-02-02 15:19:23

标签: mongodb

我在DB中有这个架构

# app_data:
{ 
    "_id": ObjectId("fff... "),
    "name": "App1",
    "customer": ObjectId("abc... ")

}

# customer:
{
    "_id": ObjectId("abc... "),
    "name": "Oskar Arenas",
    "telephone_number": "567567546"
}

我想要检索:

{ 
    "name": "App1",
    "customer_data": {
         "_id": ObjectId("abc... "),
         "name": "Oskar Arenas",
         "telephone_number": "567567546"
         }

}

是否有任何mongodb函数可以在单个查询中获取数据而不是ObjectId?

0 个答案:

没有答案