Seems like Couchbase Lite / Mobile deliberately keeps the attachment metadata read-only by exposing a read-only immutable data structure in the interface. There have been times where I have wished to be able to write attachment metadata that feels like it belongs with the attachment rather than in the associated document – things like the last-updated date of the attachment. Is that something you have considered and rejected?
The attachment metadata is really just a property named _attachments
that you can change just as you’d change any other property. (But don’t mess with any of the properties that are already in there, like length
or encoding
. Well, you can change content_type
.)
It’s unclear whether user-defined properties will work. Couchbase Lite and Sync Gateway will ignore properties they don’t know about, and will preserve them when updating the document. However, I don’t know what other compatible databases like CouchDB, PouchDB or Cloudant will do.