From couchdb-user-return-417-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Tue May 13 22:14:05 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 63942 invoked from network); 13 May 2008 22:14:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2008 22:14:05 -0000 Received: (qmail 14523 invoked by uid 500); 13 May 2008 22:14:06 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 14499 invoked by uid 500); 13 May 2008 22:14:06 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 14488 invoked by uid 99); 13 May 2008 22:14:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 15:14:06 -0700 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: domain of damienkatz@gmail.com designates 64.233.166.183 as permitted sender) Received: from [64.233.166.183] (HELO py-out-1112.google.com) (64.233.166.183) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 22:13:20 +0000 Received: by py-out-1112.google.com with SMTP id a25so2480863pyi.13 for ; Tue, 13 May 2008 15:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; bh=0hDmBrSJL3Z1bvAfN8lMOwrITYvUe2m8ocUVCXXUtiY=; b=FnA16bpDDxCKCQAhj/dRRWBkLZ9hrb11Ji/aEP3vyEoKTWpWNRvXBNv7q9fkUinNPW6ZhUVqkEs41ja9zGcxsFeu0Za4pIVhERphrZUBdMuV7pFw+TIgNgu5kixQbGMMumfQrEZaa8bfKu2dFRUvc8CNIAMSP2Z1bdFPuhWdp9Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; b=LrelSDK+4GvvT/Q8cfPR6+dAYO02f59BPAbjehK1rsiRK8KgIGXwKzTE5N1HnQoEnD16krPu6Hu+D7TgwbpPni3ozk90LVQEpFPOpg93Un4TyMi3Byh1+Upmats8vfH44eBKIheGCVl2YbyLZlvZNl22WxFZs+slmhH6177Yzqo= Received: by 10.35.75.15 with SMTP id c15mr410401pyl.62.1210716813945; Tue, 13 May 2008 15:13:33 -0700 (PDT) Received: from ?10.0.1.191? ( [71.68.49.63]) by mx.google.com with ESMTPS id a22sm426658pye.33.2008.05.13.15.13.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 13 May 2008 15:13:32 -0700 (PDT) Message-Id: <620A78EB-7A70-48C0-95B8-27348FE31CAB@gmail.com> From: Damien Katz To: couchdb-user@incubator.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: mapping on a key that doesn't exist Date: Tue, 13 May 2008 18:13:31 -0400 References: <2191326F-93DB-4AB3-918B-3BC29BE89FC4@gmail.com> <20080513214811.GE31434@vex.pobox.com> X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org On May 13, 2008, at 5:57 PM, Bob Briski wrote: >> >> I would guess that the json encoder used by the view server doesn't >> know what >> to do with an undefined (not null) value. > > Good point. So would the best practice to avoid a problem with > future schemas be to check all fields that are present in the key? Yes, if you expect that future documents won't have those fields, then check for them and provide a default if missing. You can write helper routines to make it easy. And you can always change the view definition to accommodate new document types. Views don't have to be future proofed, it's possible to change their details without affecting the clients that query the views. Also new views can be added to deal with more documents types, that work without affecting the old views. -Damien