benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Unable to attach multiple files #13

Closed mdaguete closed 14 years ago

mdaguete commented 14 years ago

Hello,

I', trying to attach multiple files to a document, but only the last one it's stored.

The problem seems to be related to couchbeam_db:put_attach/6, it not returns the full object after success.

In my code, after the functions returns if I open the document by id and I use it to add another attachment it works.

Regards.

benoitc commented 14 years ago

Could you provide a snippet about this ? Afaike put_atachments is used to send attachments one by one. If you want to send inline attachments use couchbeam_doc:add_attachment function to add attachmets to the doc and then save the doc. Not sure I understood anyway so a snippet could help :)

mdaguete commented 14 years ago

Sorry, now I understand you, I was usign put attachment in a loop to add all atachments ... I'm going to test couchbeam:_doc:add_attachment ..

Another question .. is there any suport for standalone attachments ?

Regards

benoitc commented 14 years ago

put_atatchments/fetch_attachments are for that. If you do it in a loop don't forget to pass just latest doc. have a look in tests or here :

http://benoitc.github.com/couchbeam/attachments.html

mdaguete commented 14 years ago

Ok, thanks

benoitc commented 14 years ago

closing this issue so.