So in CouchDB, you can supposedly change mime types. In Futon you just have to go and edit the source of the document and change the content_type field on attachments in the _attachment field. Trouble is, when I do this so that an appcache file has the correct mime type (text/cache-manifest), and save the document, it doesn't save and the content_type field is just blank again "". Any tips on outputing the right mim开发者_StackOverflowe type?
Wow, that is weird.
You can work-around this problem by adding a Content-Type: text/cache-manifest
header when you store the attachment.
I think this will not work from a browser because it overrides the Content-Type. You can use curl from the command-line to upload an attachment. You need to know the document's current _rev
revision value.
curl -X PUT -H "Content-Type: text/cache-manifest" \
--data-binary @/path/to/appcache/file \
http://localhost:5984/db/the_doc/cache.manifest?rev=123-abcdef
The _attachments object is not user editable, which explains why your update did not work as expected. The most you can do with _attachments is to remove attachments completely by removing them from the object.
精彩评论