Den 02. jan. 2012 08:58, skrev Walter Werner:
How about if every document get a parent attribute? root document id: 123 parent: undefined child document id: 768 parent: 123 child child document id: 991 parent: 768 etc. You need then a view with the parent as a key. With one request you can get all his children (only 1 level) of a document. Then you proceed with the children-documents and ask again whether they have children. Maybe it will be a performance Issue, if your 'object' has too many levels. The advantage is, that you don't have to think about how the id's of your documents should look like.
That is almost what I'm currently trying. I Have a topmost_parent attribute, then a parent attribute and a next_sibling attribute. That way, I can get all elements with one request. I still have to process on the client, but I think it should work. The optimal solution would allow me to get it ordered correctly from the database, but I see no way of achieving that.
Jo-Erlend Schinstad