Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 45689 invoked from network); 14 Oct 2010 12:27:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Oct 2010 12:27:50 -0000 Received: (qmail 8454 invoked by uid 500); 14 Oct 2010 12:27:50 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 8332 invoked by uid 500); 14 Oct 2010 12:27:48 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 8325 invoked by uid 500); 14 Oct 2010 12:27:47 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 8318 invoked by uid 99); 14 Oct 2010 12:27:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 12:27:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 12:27:44 +0000 Received: from eosnew.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 326D8858; Thu, 14 Oct 2010 12:27:13 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Thu, 14 Oct 2010 12:27:13 -0000 Message-ID: <20101014122713.78772.3622@eosnew.apache.org> Subject: =?utf-8?q?=5BCouchdb_Wiki=5D_Update_of_=22View=5FSnippets=22_by_DougReede?= =?utf-8?q?r?= X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for c= hange notification. The "View_Snippets" page has been changed by DougReeder. The comment on this change is: improved JavaScript. http://wiki.apache.org/couchdb/View_Snippets?action=3Ddiff&rev1=3D38&rev2= =3D39 -------------------------------------------------- } }}} = - However, if you have more than just a few fields that need to be tested f= or abcense you can use another approach instead of creating a view for each= negation: + However, if you have more than just a few fields that need to be tested f= or absense you can use another approach instead of creating a view for each= negation: = {{{#!highlight javascript function (doc) { @@ -694, +694 @@ for (idx in fields) { // Does the current field exists? - if (typeof eval("doc." + fields[idx]) =3D=3D=3D void 0) + if (!doc.hasOwnProperty(fields[idx])) { // It doesn't, emit the field name as key emit(fields[idx], null);