0
我有三種文檔類型:MainCategory,Category,SubCategory ...,每個文檔都有一個與其父文檔的id相關的parentid。CouchDB視圖 - 多次連接...可以完成嗎?
所以,我想設置一個視圖,以便我可以獲得SubClass類的列表(最好只是使用map函數)...我還沒有找到一種方法來安排視圖,所以這是可能的。
我公司目前已經建立了一個圖,該得到下面的輸出 -
{"total_rows":16,"offset":0,"rows":[
{"id":"11098","key":["22056",0,"11098"],"value":"MainCat...."},
{"id":"11098","key":["22056",1,"11098"],"value":"Cat...."},
{"id":"33610","key":["22056",2,"null"],"value":"SubCat...."},
{"id":"33989","key":["22056",2,"null"],"value":"SubCat...."},
{"id":"11810","key":["22245",0,"11810"],"value":"MainCat...."},
{"id":"11810","key":["22245",1,"11810"],"value":"Cat...."},
{"id":"33106","key":["22245",2,"null"],"value":"SubCat...."},
{"id":"33321","key":["22245",2,"null"],"value":"SubCat...."},
{"id":"11098","key":["22479",0,"11098"],"value":"MainCat...."},
{"id":"11098","key":["22479",1,"11098"],"value":"Cat...."},
{"id":"11810","key":["22945",0,"11810"],"value":"MainCat...."},
{"id":"11810","key":["22945",1,"11810"],"value":"Cat...."},
{"id":"33123","key":["22945",2,"null"],"value":"SubCat...."},
{"id":"33453","key":["22945",2,"null"],"value":"SubCat...."},
{"id":"33667","key":["22945",2,"null"],"value":"SubCat...."},
{"id":"33987","key":["22945",2,"null"],"value":"SubCat...."}
]}
哪個查詢字符串參數我會用得說其具有與[「22945」開頭的鍵行....當我所有(在查詢時間)是ID「11810」(在查詢時我不知道ID「22945」)。
如果有任何意義。
感謝
馬塞爾感謝您的意見。我已經接受了你的建議,並與「祖先陣列」一起走了......它運作得非常好。 – dworrad 2010-09-08 11:45:21
我也創建了一個列表函數,將平面視圖吐出一個樹狀結構,這個結構也很好用。 – dworrad 2010-09-08 11:46:28