couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Another use case for bulk_docs transactions
Date Fri, 01 May 2009 12:52:49 GMT
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?



View raw message