Hello all,

The documentation is a bit unclear on this, but basically I was
wondering what sort of atomicity guarantees exist for _update
handlers. Suppose I have documents that look like this

{ 'states' : [ { 'oldstate' : 'created', 'newstate' : 'new' } ] }

And an update handler that looks like this (probably not the exactly
right syntax)

function (doc, req) {
  // check that the requested old state equals the previous new state
  if doc.states[ len(doc.states) ]['newstate'] == req.query['oldstate'] {
     // update the document, adding a new state to the end of doc.states
  } else {
     // barf back to the user
  }
}

Is there a guarantee that concurrent requests to the same instance
can't end up with a garbled ordering of states?

Thanks,
Andrew

-- 
--
Andrew Melo

Reply via email to