Take the 2-minute tour ×  I'm writing cms like application and I
would like my images to be stored as attachments in couchdb. The
problem is in naming the attachments because I don't want my
images to be named the same (e.g. /db/doc_id/thumb.jpg)  Ideally
attachments names should depend on doc.name field. To make this
work I would have to rename attachment each time user changed
the name (description|alt) of current photo document.  So my
question is: how to change attachment name? or maybe I should go
other way in solving my problem?  share|improve this question  2
Answers 2  up vote 2 down vote accepted   I'd suggest
considering using UUIDs for the document names, and storing the
attachment as something "static" like "original", "thumb",
"300wide", etc. The name given by the user when they upload the
file can be stored as a key, and you can use a MapReduce index
to retrieve the image/file using that name later.  If you go
that route, though, you'll have to come at the "duplicates"
problem a bit differently-