Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 48387 invoked from network); 2 Sep 2010 10:07:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Sep 2010 10:07:19 -0000 Received: (qmail 87961 invoked by uid 500); 2 Sep 2010 10:07:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 87657 invoked by uid 500); 2 Sep 2010 10:07:16 -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 87649 invoked by uid 99); 2 Sep 2010 10:07:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 10:07:15 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mikhail.pokidko@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 10:07:07 +0000 Received: by vws14 with SMTP id 14so431932vws.11 for ; Thu, 02 Sep 2010 03:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=einiVa0EXHEmATqkZtQOer+/4UphQMmi87/GGd83MGA=; b=qzJqM1S4ka2TDjWgtltrK9TOnL/QeN7lC9yVfXIvd8eQjFQ73utJ3QKogEWXTupcfR 02ugAKBFO5d5ShMaln5CvBJ6/ZgOga4A8/Kx9O94DsEzsdLr0G8d8KaDiSDs7KLo3xQo yB4anH30/4zyKMyqBby+XoM01cQHs139wx4L8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Z1I0nAw3qG81ECb5ygQGujrqe6Ctb+zk8cVYkHLZAd+40QoZZcuysrOYkhKEIgRIJy A9yGs2jII1owZjj424xdlRFBrIdl/Nn+fZtrVshhIOjk5E3HCkUWTR9GwJgHijgXAY3R gx8EbeGnUkUEvuzEH+oWsCmnoHXEAS+VPWrMc= MIME-Version: 1.0 Received: by 10.220.123.160 with SMTP id p32mr5264061vcr.220.1283422006349; Thu, 02 Sep 2010 03:06:46 -0700 (PDT) Received: by 10.220.41.135 with HTTP; Thu, 2 Sep 2010 03:06:46 -0700 (PDT) Date: Thu, 2 Sep 2010 14:06:46 +0400 Message-ID: Subject: searching for something like AND clause From: "Mikhail A. Pokidko" To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hello all! I have docs with such fields : {'type':'offer', 'city':''Moscow', 'expires':'2010/08/30 22:54:00',} And now i`m stuck finding the way how to get unexpired offers for certain city. My first attempt was writing view like this: function(doc) { var today = new Date(); if (doc.type == 'offer') { var created = new Date(doc.expiration_full); if (created > today) { emit(doc.city, doc); } } } But "today" stays as defined at the moment of view save. (Yes, i understand that other way indexes should be recalculated every time) So is there any clever way to get unexpired offers for certain city without writing view-per-city?startkey=%{today_date} ? -- xmpp: pma AT altlinux DOT org