incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <damienk...@gmail.com>
Subject Re: mapping on a key that doesn't exist
Date Tue, 13 May 2008 22:13:31 GMT


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

Mime
View raw message