Monday, May 11, 2009

Adding attachment to CouchDB's document

CouchDB can be attached some file toward document from 0.9.0.The previous version could make inline attachment,and last version could make some attachment standalone.

So I tested like this:
$curl -X PUT http://hostname/database/document/test.txt?rev=nnn -H "Content-Type: text/plain" -d @test.txt

And this,too:
$curl -X PUT http://hostname/database/document/test.jpg?rev=nnn -H "Content-Type: image/jpeg" --data-binary @test.jpg

That's useful function.I'd like to image&create some cool service using CouchDB.Actually,I had mistake that I couldn't update jpeg file cause of my wrong settings.So I emailed my trouble to offcial mailing list,and I got correct settings.I didn't know "--data-binary" description.The man who answered my question was so kind !!

No comments:

Post a Comment