You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Pulkit Singhal <pu...@gmail.com> on 2012/03/29 23:20:05 UTC
Adding additional fields to _attachments
Is it possible to add additional info about an attachment to a document?
For example, if images may be uploaded to a document and you want to know
which user uploaded which attachment.
I have this in my CouchDB:
"_attachments": {
"blah.png": {
"content_type": "image/png",
"revpos": 3,
"digest": "md5-UesBCc6fFHHPxYyIy+fGXA==",
"length": 97709,
"stub": true
}
}
And I tried to edit it in Futon and put an additional attribute "user" :
"username" into it but the change didn't take effect, I confirmed this by
polling the info after saving it.
Any suggestions on the right approach to do this?
Re: Adding additional fields to _attachments
Posted by Robert Newson <rn...@apache.org>.
Nope. Fields beginning with _ are reserved by the system. In this
case, _attachments is not really part of your document at all, it's
added by couchdb from its knowledge of your attachments.
You can add an "attachments" object that mirrors _attachments and
store any attributes you like there.
B.
On 29 March 2012 22:20, Pulkit Singhal <pu...@gmail.com> wrote:
> Is it possible to add additional info about an attachment to a document?
> For example, if images may be uploaded to a document and you want to know
> which user uploaded which attachment.
>
> I have this in my CouchDB:
> "_attachments": {
> "blah.png": {
> "content_type": "image/png",
> "revpos": 3,
> "digest": "md5-UesBCc6fFHHPxYyIy+fGXA==",
> "length": 97709,
> "stub": true
> }
> }
>
> And I tried to edit it in Futon and put an additional attribute "user" :
> "username" into it but the change didn't take effect, I confirmed this by
> polling the info after saving it.
>
> Any suggestions on the right approach to do this?