Custom Attributes for CouchDB Attachments

I am trying to store multiple standalone attachments in a single CouchDB document and assign arbitrary attributes (i.e. description) to each of them. Is there a convention for this? From what I can say, I cannot insert them directly into the _attachments structure. Thanks in advance!

+7
source share
1 answer

You cannot modify anything in _attachments directly, as it is reserved for use by CouchDB. However, it would be wise to store arbitrary attributes in a member, such as attachment_attributes , using the same keys as _attachments (attachment names). For example:

 { "_attachments": { "foo.bar": ..., "xxx.yyy": ... }, "attachment_attributes": { "foo.bar": { "description": "blah blah" }, "xxx.yyy": { "description": "blah blah" } } } 
+8
source

All Articles