couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jo-Erlend Schinstad <joerlend.schins...@gmail.com>
Subject Re: Modeling a tree in couchdb.
Date Mon, 02 Jan 2012 22:07:17 GMT
Den 02. jan. 2012 22:53, skrev Keith Gable:
> The method I use is to have a field called "path", which contains a list of
> IDs, and the last item in the list/array is the current document's ID. The
> downside is that you have to assign the IDs yourself, but the upside is
> that it's easy to query.
>
> ---

Right. But consider this list of elements: [1,2,3,4,5]. What happens if 
I insert something before 3? Then, 3 becomes 4, 4 becomes 5 and 5 
becomes 6. If this list is a million entries long, then you would need 
to update 999.997 documents. Then all those would need to be sent to all 
the other databases, etc. That's the problem. For immutable trees, in 
the sense that the structure and order doesn't change, your solution 
works nicely.

Jo-Erlend Schinstad



Mime
View raw message