我有一个文件依赖于其他文件.第一:
{
"doctype": "closed_auctions",
"seller": {
"person": "person11304"
},
"buyer": {
"person": "person0"
},
"itemref": {
"item": "item1"
},
"price": 50.03,
"date": "11/17/2001",
"quantity": 1,
"type": "Featured",
"annotation": {
"author": {
"person": "person8597"
}
}
Run Code Online (Sandbox Code Playgroud)
在这里你可以看到doc.buyer.person依赖于这样的另一个文件:
{
"doctype": "people",
"id": "person0",
"name": "Kasidit Treweek",
"profile": {
"income": 20186.59,
"interest": [
{
"category": "category251"
}
],
"education": "Graduate School",
"business": "No"
},
"watch": [
{
"open_auction": "open_auction8747"
}
]
}
Run Code Online (Sandbox Code Playgroud)
如何从这两个文件中获取买方名称?我的意思是doc.buyer.person与第二个文档的id相关联.它是连接,从文档中不清楚.http://docs.couchbase.com/couchbase-manual-2.0/#solutions-for-simulating-joins
好吧,首先,请允许我指出您引用的文档部分的第一句话(我添加了重点):
即使被检查的文档包含在同一个存储桶中,数据之间的连接也不可能直接在视图系统中进行.
所以,你的问题的快速答案是你有很多选择.这里有几个:
您在问题中链接的示例中使用了最后一种方法.为了提高性能,有必要根据您的使用场景定制方法.
| 归档时间: |
|
| 查看次数: |
2508 次 |
| 最近记录: |