couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <d...@muse.net.nz>
Subject Re: suggestions on how to structure a delicious clone
Date Mon, 28 Mar 2011 20:56:05 GMT
On 29 March 2011 07:46, Zdravko Gligic <zgligic@gmail.com> wrote:
> Bryan,
>
> I am working on something very similar where instead of less formal
> "tags", my use case involves more formal "categories" that are at
> least somewhat hierarchical in nature.

Hi Zdravko

If your hierarchies are always consistent, then I'd suggest using
linked docs http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documents

store your categories as normal in the doc.
have an additional view that maps categories to their full hierarchy,
using the category or a permutation of it as the _id (kinda like a
hashing function).
you can then pull in with one call the doc and the category which maps
to the full hierarchy in a separate doc, or use a show/list for
further server-side processing.

> So, one of my struggles is whether I have to place each doc into both
> its child and its parent/grand parent categories.  I would not need to
> do so, if somehow I could submit a single request for multiple
> start/end key values.

Depending on your data model, linked docs might solve this for you.

Cheers
Dave

Mime
View raw message