Hello all,
We set out to use CouchDB as a piece of software that can easily be used
to create REST APIs. We publish documents to CouchDB, add some views and
show/list functions, put Apache httpd+mod_rewrite in front for the
pretty URLs and there is your super fast REST API!
Well, that was the idea, but we ran into an issue. We have a view that
returns events with start and end timestamps. It should be possible to
ask the API for a list of current events and events that are upcoming. I
thought I'd just emit the end timestamp as the key and query using
startkey=currenttime. This returns the correct events, but the list is
sorted by end timestamp.
The API would make a lot more sense if it would return a list sorted by
start timestamp, but I don't see a way to do this without adding some
server-side logic to sort the results from the view query. This would
mean adding another layer to the setup: more complexity and loss of
performance probably. Is it really not possible to accomplish this with
just CouchDB or do I miss some way of mapping and/or querying the data
which does yield the desired result?
Nils Breunese.
- Sorting view queries Nils Breunese
-