couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bsquared <bwcod...@gmail.com>
Subject can update function return doc?
Date Mon, 10 Oct 2011 01:10:04 GMT

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\">> ... 
-- 
Regards,
Brian Winfrey


Mime
View raw message