incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniele Testa <daniele.te...@gmail.com>
Subject One view per "query"?
Date Fri, 10 Jun 2011 09:41:03 GMT
Hi all,

I just want to check with you guys that I understand things correctly.

Lets say I have a database that stores music songs.

Each song has a "title", "insert_date", "album", "genre".

Now, if I want to do these "queries":

"All songs that belongs to album=X ordered by title"
"All songs that belongs to genre=X ordered by insert_date descending"
"All songs that belongs to genre=X ordered by title"
"All songs ordered by insert_date descending"

Etc..

Is it true that I will have to create an unique view for each of these cases?

I assume I cannot do something like

emit( [doc.album, doc.genre, doc.insert_date, doc.title], doc);

And then just choose what index in that array I want to use? It is
ordered left-to-right, right?

That would mean that I cannot do something like

startkey=[null, null, 0, null]&endkey=[null, null, {}, null]

.. to get all songs ordered by "insert_date"?

Regards,
Daniele

Mime
View raw message