Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 35671 invoked from network); 4 Nov 2009 21:50:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 21:50:24 -0000 Received: (qmail 63456 invoked by uid 500); 4 Nov 2009 19:00:23 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 63390 invoked by uid 500); 4 Nov 2009 19:00:23 -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 63380 invoked by uid 99); 4 Nov 2009 19:00:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 19:00:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of adam.kocoloski@gmail.com designates 72.14.220.159 as permitted sender) Received: from [72.14.220.159] (HELO fg-out-1718.google.com) (72.14.220.159) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 19:00:13 +0000 Received: by fg-out-1718.google.com with SMTP id 16so1052833fgg.5 for ; Wed, 04 Nov 2009 10:59:53 -0800 (PST) Received: by 10.86.108.19 with SMTP id g19mr467674fgc.16.1257361193427; Wed, 04 Nov 2009 10:59:53 -0800 (PST) Received: from ?10.0.1.9? (c-66-31-20-188.hsd1.ma.comcast.net [66.31.20.188]) by mx.google.com with ESMTPS id d6sm79617fga.0.2009.11.04.10.59.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 10:59:52 -0800 (PST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v1076) Subject: Re: mapping on non existing fields From: Adam Kocoloski In-Reply-To: Date: Wed, 4 Nov 2009 13:59:43 -0500 Content-Transfer-Encoding: 7bit Message-Id: References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1076) X-Virus-Checked: Checked by ClamAV on apache.org On Nov 4, 2009, at 11:26 AM, Duy Nguyen wrote: > Hi, > > Im new to couchDB and im curious what couchDB behaves when I try to > MAPPING > non-existing fields. > > For example: > > Document 1 has field1, field2, field3 > Document 2 has field1, fied4, field5 > > function1 (doc) { > emit (doc.field1, doc.field4); > } > > function2 (doc) { > emit (doc.field6, doc.field7); > } > > What are the results from function 1 and function 2 ? > > Thanks. function2 will throw an exception in the view server. It's not fatal, but it's expensive, so not a good idea. You should check for the presence of the field first. Best, Adam