couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: mapping on non existing fields
Date Wed, 04 Nov 2009 18:59:43 GMT
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


Mime
View raw message