Hi Marty,
Did you make any progress yet on the TouchDB-Android replicator? I seem to be having a similar problem when creating attachments. I am trying to add an attachment to an existing document using the following piece of code:
final File attachmentFile = new File(URI.create(uri.toString()));
final String contentType = "image/jpeg";
final AttachmentInputStream attachmentContents = new AttachmentInputStream(attachmentFile.getName(), new FileInputStream(attachmentFile), contentType);
couchDbConnector.createAttachment(resourceId, revision, attachmentContents);
Note that uri points to a valid file, and both resourceId and revision are also correct.
I'm not getting any errors in the log but after replicating to the central CouchDB, the document has no attachments whatsoever. Even worse: any existing attachments seem to have been removed from the document as well.
The local version of the document does seem to have the attachment attached correctly.
Kind regards,
Bart
--
is there any progress on the TouchDB attachments Replication.
Hi all,quick question: do attachments get replicated across touchdb and couchdbs?(I saw prior posts with problems regarding this, e.g. https://groups.google.com/forum/#!topic/mobile-couchbase/h_7sAddedvw)When I add an image attachment to a document on the touchdb client -- following which I can get the attachment and display it locally -- the attachment does not show up on the couchdb server. To check, I can see the local document size go from 100kB to 600kB when I add a photo, but the remote document size only increases from 20kB to 33kB. (curl -X GET ../_all_docs output below).Other android clients replicating with couchdb crash when trying to get the attachment from their local touchdb. The document name, however gets replicated correctly, which indicates that replication (minus the attachments) seems to work fine across touchdb and couchdb.Let me know if you have any suggestions! Thanks,MohitSetup: Touchdb-android(JB)-client replicating push and pull with Couchdb 1.2.0Code for creating attachment on touchdb client:public void insertPhoto(Photos photo) {String imagePath = photo.getUri();File file = new File(imagePath);InputStream data = null;try {data = new FileInputStream(file);} catch (FileNotFoundException e) {e.printStackTrace();}String contentType = "image/jpeg";AttachmentInputStream a = new AttachmentInputStream(new String(photo.getTimeStamp()),data, contentType);lastInsertedId = dbInterface.createAttachment(new String(photo.getTimeStamp()), a); // calls dbConnector.createAttachment(string, a);}_all_docs on touchdb: curl -X GET touchdb-android:5984/photoapp/_all_docs{"offset":0,"total_rows":2,"rows":[{"value":{"rev":"1-9b6b0dc3-2220-4789-a2a5-d4a311b1727b"},"id":"IMG_20121025_024511.jpg","key":"IMG_20121025_024511.jpg"},{"value":{"rev":"1-2ac6632b-8aca-453c-a955-7546d560fc68"},"id":"IMG_20121025_024633.jpg","key":"IMG_20121025_024633.jpg"}]}_all_docs on couchdb: curl -X GET server:5984/photoapp/_all_docs{"total_rows":2,"offset":0,"rows":[{"id":"IMG_20121025_024511.jpg","key":"IMG_20121025_024511.jpg","value":{"rev":"1-9b6b0dc3-2220-4789-a2a5-d4a311b1727b"}},{"id":"IMG_20121025_024633.jpg","key":"IMG_20121025_024633.jpg","value":{"rev":"1-2ac6632b-8aca-453c-a955-7546d560fc68"}}]}
i have same issue, is there any progress on that ?