You need to encode the response:

return [doc, toJSON(resp)]

g jo
Am Sonntag, den 09.10.2011, 18:10 -0700 schrieb bsquared:
> I am trying to get an update function to return the document as the
> response. 
> 
> This responds with error [1]. 
> 
> function (doc,req) {
>     
>     var docId = doc ? doc._id : req.uuid;
> 
>     if (!doc) {
>       doc = {}; 
>       doc._id = docId;
>       doc.create_date = new Date ();
>               doc.title = new Date ().toDateString ();
>     } 
> 
>     doc.last_change_date = new Date ();
> 
>     var resp =  {key : docId, value: doc};
>     return [doc, resp];
> }
> 
> [1] - {"error":"external_response_error","reason":"Invalid data from
> external server: {<<\"value\">>,\n {[{<<\"_id\">> ... 


Reply via email to