incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Szymon Kapeniak <szymon.kapen...@gmail.com>
Subject How to get nested-key-sorted collection of documents
Date Sun, 22 Nov 2009 12:33:50 GMT
Hello,
I'm struggling with this problem recently and couldn't find any
solution. Maybe some users could put me on the right track, as I am
rather new to couchdb and databases in general.

Let's say I have a number of documents with book records like:
"author", "title", "subject", '"date of publish", "publisher", "number
of copies" etc.

Now I want to retrieve from couchdb list of documents sorted by many
nested keys. What I need at the end is like a python dictionary with
above records as keys, and doc _ids as values. The point is to make it
nest-able with arbitrary order of keys . Ideally this would be all
done by couchdb not client. But I'm not sure if it's possible.

Simplest view can be seen like:

author:
- Tolstoj :  list of  _ids
- Goethe:  list of _ids
- Blake:    list of  _ids

this is easy one, but I need:

author:
- Tolstoj : 1985: list of _ids
              : 1992: list of _ids
- Goethe : ...

and even more:

author:
- Tolstoj:  1985: publisher: X: list of _ids
                                         : Y: list of _ids
             :  1992: ...

- Goethe: 1950:

and also in reverse:

author:
- Tolstoj:  publisher : X: 1985: list of _ids
                                     :1992: list of _ids


So the point is to not hard code keys and their order into a view, but
being able to dynamically change and retrieve a view of nested
keys/ids. XML or Python dictionary should be a result of that if
possible. Dear All, any idea how to approach this?

Thanks,
skk.

Mime
View raw message