How do you currently organise the documents into a tree and display them?
For my trees, I have a 'hierarchy' array attribute that basically holds
a tree address, eg:
A = {"_id":"A", .... "hierarchy":["A"]};
B = {"_id":"B", .... "hierarchy":["B"]};
C = {"_id":"C", .... "hierarchy":["B","C"]};
D = {"_id":"D", .... "hierarchy":["A","D"]};
E = {"_id":"C", .... "hierarchy":["B","E"]};
F = {"_id":"C", .... "hierarchy":["B","E","F"]};
If you then create a view that emits the hierarchy attribute as the key,
it will automatically sort them into lexicographic (tree) order.
If you want to delete B+descendants, you:
1. Query that view with:
startkey=["B"] &
endkey=["B",{}]
to get the B document and every descendant of B,
2. Delete them all.
On 27/05/2010 1:48 PM, Aun... สุวพรหม wrote:
Hi,
I design document in couchdb to have relation something like
directory
|
A---------D
|
B---------C
|
|
E ------F
if i would like to http (DELETE B) will delete all down documents
what is the possible solution to use.
1. can i create view and find relation and delete all of
them ?
2. get relation by higher programming api (C#,PHP) and
then delete each one?
3. Do you have any solution to suggest on this.....?
Thanks,
A.
_________________________________________________________________
Hotmail: บริการอีเมลฟรี ที่เชื่อถือได้ และสมบูรณ์พร้อม
https://signup.live.com/signup.aspx?id=60969