Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 63940 invoked from network); 3 Jul 2009 11:44:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Jul 2009 11:44:40 -0000 Received: (qmail 31936 invoked by uid 500); 3 Jul 2009 11:44:49 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 31848 invoked by uid 500); 3 Jul 2009 11:44:49 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 31836 invoked by uid 99); 3 Jul 2009 11:44:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2009 11:44:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [145.58.30.185] (HELO out1b.mail.omroep.nl) (145.58.30.185) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Jul 2009 11:44:39 +0000 Received: from localhost (ou1bclean [10.10.30.159]) by out1b.mail.omroep.nl (Postfix MTA - NPO ICT) with ESMTP id 173193000117 for ; Fri, 3 Jul 2009 13:44:17 +0200 (CEST) X-Virus-Scanned: NPO ICT Received: from out1b.mail.omroep.nl ([145.58.30.185]) by localhost (out1b.mail.omroep.nl [10.10.30.158]) (amavisd-new, port 10024) with ESMTP id O+5BMP7TvCrl for ; Fri, 3 Jul 2009 13:44:17 +0200 (CEST) Received: from tweehoog.vpro.nl (tweehoog.vpro.nl [145.58.169.70]) by out1b.mail.omroep.nl (Postfix MTA - NPO ICT) with ESMTP id F31E230000BF for ; Fri, 3 Jul 2009 13:44:16 +0200 (CEST) Received: from digi174.vpro.nl ([145.58.169.174]) by tweehoog.vpro.nl with esmtp (Exim 3.36 #1) id 1MMhBg-00029Q-00 for user@couchdb.apache.org; Fri, 03 Jul 2009 13:44:16 +0200 Message-ID: <4A4DEF10.3000002@vpro.nl> Date: Fri, 03 Jul 2009 13:44:16 +0200 From: Nils Breunese User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: CouchDB Users Subject: Sorting view queries Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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.