Support for _update methods #31

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
1 participant
@tanepiper
Contributor

tanepiper commented Jan 4, 2011

Added support for _update handler methods (http://wiki.apache.org/couchdb/Document_Update_Handlers)

An example update might be:

"updates": {
"modified": function(doc, req) {
var date = req.query.date;
var name = req.query.name;

  var message = "set name & modified to " + [name, date].join(',');
  doc['name'] = name;
  doc['modified'] = date;
  return [doc, message];
}

}

Say the design document was called 'Foo', you would call it like this:

db.update("Foo/modified", doc.id, {"name":"Bar", "date": new Date().toString()}, function(error, message) {})

@tanepiper

This comment has been minimized.

Show comment
Hide comment
@tanepiper

tanepiper Jan 22, 2011

Contributor

+1 all applied now, thanks

Contributor

tanepiper commented Jan 22, 2011

+1 all applied now, thanks

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment