Re: [lightcouch:127] Multiple attachments

24 views
Skip to first unread message

Ahmed Yehia

unread,
Dec 14, 2014, 9:33:26 AM12/14/14
to light...@googlegroups.com
The second attachment might be using an older revision, you can get the updated value by returning Response object.
Response response = dbClient.saveAttachment(input, "WallPicture", "image/jpg", obj.getString("_id"), obj.getString("_rev"));
response = dbClient.saveAttachment(input1, "tiger", "image/jpg", obj.getString("_id"), response.getRevision());

On Sat, Dec 13, 2014 at 7:01 AM, Sindhu Selvaraj <sindhus...@gmail.com> wrote:
Hi,

I am using 0.1.3 version of LightCouch. I am quite new to it.

When I try to save multiple attachments to an existing document, DocumentConflictException is being raised.

Is it possible to save attachments to an existing document are am I doing it wrong?

This is what I tried,

InputStream input = new FileInputStream(new File("C:/Users/workspace/couchClient/color.jpg"));

InputStream input1 = new FileInputStream(new File("C:/Users/workspace/couchClient/tiger.jpg"));

dbClient.saveAttachment(input, "WallPicture", "image/jpg", obj.getString("_id"), obj.getString("_rev"));

dbClient.saveAttachment(input1, "tiger", "image/jpg", obj.getString("_id"), obj.getString("_rev"));


Also I want to know, how to insert/update String values to JsonArray that is added to the document like this.

JsonObject json = new JsonObject();
json.addProperty("_id", "List_id");

json.add("array", new JsonArray());

dbClient.save(json);

Thanks in Advance.

--
You received this message because you are subscribed to the Google Groups "LightCouch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightcouch+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages