couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: couchdb errors -
Date Tue, 30 Dec 2008 10:47:24 GMT

On 30 Dec 2008, at 10:07, paul jobs wrote:

> http://rafb.net/p/oz8VfH95.html
> [Tue, 30 Dec 2008 09:04:46 GMT] [info] [<0.134.0>] OS Process Log  
> Message:
> function raised exception (Cannot encode 'undefined' value as JSON)  
> with
> doc._id bef1111175e1d5052e9c49db546b39db

Your Javascript is using an object member that is not defined. E.g.:

{
   "_id":"XYZ123",
   "_rev":"1BB2BB",
   "field":"value"
}

map: function(doc) {
   emit(doc.name, doc.address);
}

instead, try this:

map: function(doc) {
   if(doc.name && doc.address) {
     emit(doc.name, doc.address);
   }
}
Cheers,
Jan
-- 

Mime
View raw message