incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garvin <>
Subject Setting document _id in _update handler
Date Tue, 02 Mar 2010 21:53:16 GMT
Hi again,

Does anyone know a server-side workaround for this

Apparently if you use an _update handler for creating a document you are
responsible for the _id because CouchDB won't set it to a UUID if you just
leave it undefined. :'(

Here's my update handler for reference:

function(doc, req) {
  var newDoc = JSON.parse(req.body);
  newDoc.created_at = (new Date()).getTime();
  // newDoc._id = "is there a function I can call here to generate a UUID?";
  return [newDoc, "ok"];


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