couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominic Laflamme <Dominic.Lafla...@autodesk.com>
Subject update handler that insert a new document
Date Tue, 26 Feb 2013 12:19:40 GMT
Hello list,
I've been using and update handler which inserts new documents after time-stamping them. I
am following the documentation found here:

http://wiki.apache.org/couchdb/Document_Update_Handlers

I've been using the following update handler successfully with 0.10.0 and 1.2.0 on Ubuntu
and Windows, but I just updated to 1.2.1 and this particular handler now fails with the error
"bad return value".

function(doc,req) {
var data = JSON.parse(req.body);
data['_id'] = data.UniqueID;
if ( data.timestamp == null )
{
data.timestamp = new Date().getTime();
}
return [ data, JSON.stringify(data)];
}

Does anybody have insight on what causes the problem? Is it still "legal" to add new documents
using update handlers?

Regards,
-Dominic




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message