No, there's no way to do that, since a document must change from one revision to another atomically.
The CouchDB replicator uses multipart/related PUT to send the document and all attachments (streamed) in a single request. The max_document_size (4gb, insanely, in couchdb, 64mb on cloudant) does not apply to streamed attachments or the multipart/related PUT method. It seems like you're asserting that TouchDB doesn't follow suit, which would surprise me. B. On 9 Sep 2012, at 20:39, Jens Alfke wrote: > Is there any way to upload a single revision of a document (including > attachments) to CouchDB using multiple HTTP requests? > > I ask because a developer using TouchDB has been having trouble replicating > from his iOS app to Cloudant. With some help from tech support, he found that > the app has some documents larger than 64MB (they include large numbers of > JPEG attachments), but Cloudant limits HTTP request bodies to 64MB. > > Apparently the Cloudant folks (whom I haven’t talked with directly yet) are > saying TouchDB should be uploading “standalone attachments”; but I don’t know > of any way in the API to upload the attachments of a single revision > individually. You can of course PUT to an attachment URL, but that creates a > _new_ revision for every attachment, so this is not useable by the replicator > since its job is not to create new revisions but only to transfer existing > ones. > > I’ve closed the bug report[1], suggesting that the developer should change > the document design to store fewer attachments in one doc, but I’m asking > here in case there’s some corner of the API that might allow for a > workaround. (Although I can’t imagine what sort of state a revision would be > in when only a subset of its attachments have been uploaded yet — it would > have to be kept in some kind of limbo by the server until all the attachments > are added, since until then it’s not a true copy of the revision.) > > —Jens > > [1] https://github.com/couchbaselabs/TouchDB-iOS/issues/159
