CouchDB: save MB per document

I am analyzing couchDB at the moment. Is it possible to store data in MB format at the level per document ? For instance. JPEG image.

I understand that I would need to encode (base64 or something else) the specified data to fit the JSON container.

Practical advice sought.

+4
source share
2 answers

As zed said in his comment, the best way to do this is to use applications. The Wiki has a section on this subject: http://wiki.apache.org/couchdb/HTTP_Document_API#Attachments

The basic idea is this:

{ "_id":"attachment_doc", "_attachments": { "foo.txt": { "content_type":"text\/plain", "data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" } } } 

You are correct that Base64 encodes the contents of attachments. You can have multiple attachments for each document.

NOTE from the wiki: note that any base64 data you send must be on the same line of characters, so pre-process your data to remove any carriage returns and newlines.

+4
source

I have never tried large documents, but I use documents with large attachments (JPEG> 10 megapixels) and this works well.

The main problem is that such a huge replication of database sizes tends to break in new and interesting ways every week.

+1
source

All Articles