Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9375310093 for ; Sat, 26 Oct 2013 10:07:44 +0000 (UTC) Received: (qmail 88772 invoked by uid 500); 26 Oct 2013 10:07:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 88426 invoked by uid 500); 26 Oct 2013 10:07:37 -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 88417 invoked by uid 99); 26 Oct 2013 10:07:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Oct 2013 10:07:35 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.70.64.64] (HELO n08.mail01.mtsvc.net) (216.70.64.64) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Oct 2013 10:07:29 +0000 Received: from [95.210.98.62] (port=47100 helo=[10.0.1.4]) by n08.mail01.mtsvc.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Va0lu-0005Su-SP for user@couchdb.apache.org; Sat, 26 Oct 2013 06:07:08 -0400 From: Andru Vallance Content-Type: multipart/alternative; boundary="Apple-Mail=_3A4C483F-3E32-4AB7-8A50-5B7D98D71F65" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Skipping complex key values in a view function Date: Sat, 26 Oct 2013 12:06:56 +0200 References: To: user@couchdb.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1499) X-Authenticated-User: 911600 andru@tinymighty.com X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_3A4C483F-3E32-4AB7-8A50-5B7D98D71F65 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Is there a way to skip a value in a complex key (i.e. an array key) when = using startkey and end key? That is, is there a way to match any value = for an item in the array?=20 I have a document with a place_id, plant_id, date_created and = date_modified. Sometimes I want all docs with place_id=3DX and = plant_id=3DY, where other times I only want place_id=3DX and any = plant_id; sometimes I will want to specify a creation and/or = modification date, other times this will not be relevant. Since these = values are all user defined, and it's likely more properties will be = added in the future, I don't think it's viable to use multiple views = specific to each use case. I'm currently using a single view map emitting multiple rows with null = values to allow me to specify a null value in my startkey/endkey values. function(doc){ if(doc.type=3D=3D=3D'planting'){ emit([doc.place_id, doc.plant_id, doc.date_created, = doc.date_modified], null); emit([doc.place_id, null, doc.date_created, doc.date_modified], = null); emit([null, null, doc.date_created, doc.date_modified], null); } } Is there a more elegant way I can do this without the multiple row = emits? (note: I'm actually using PouchDB and replicating to CouchDB, so this = map query is actually being run in the browser with PouchDB) Thanks Andru Vallance= --Apple-Mail=_3A4C483F-3E32-4AB7-8A50-5B7D98D71F65--