You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Brian Candler <B....@pobox.com> on 2009/05/01 14:52:49 UTC

Another use case for bulk_docs transactions

I just realised I have another use case for bulk_docs "transactions".

Right now I am doing model validation in Ruby. If someone wants to upload a
batch of (say) 100 docs, I can validate them all in Ruby, and reject the
whole batch if any fail validation.

However, I would like ultimately to push model validation into CouchDB using
validate_doc_update. Unfortunately this isn't going to make life easy for
validating a batch. I can either:

- accept the default semantics, which probably means that all validating
  docs will be updated and all non-validating ones will not (or maybe the
  batch upload will fail at the first non-validating one; I haven't tested
  that part yet)

- submit with "all_or_nothing":true, which should accept or reject the
  whole batch, but may introduce conflicting versions which I'd have to
  tidy up afterwards (e.g. by fetching all the docs again and deleting all
  revs which didn't match the newly-created rev)

Either way isn't pretty, and for the time being this is a good reason for
keeping validation outside of CouchDB.

Any thoughts/comments?

Regards,

Brian.