You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Sho Fukamachi <sh...@gmail.com> on 2009/02/18 10:45:53 UTC

Write metadata inside _attachments?

Hi Couchists,

Having in some cases multiple attachments per document, I would like  
to be able to store some metadata next to each attachment - the width/ 
height of a picture, for example, or the bitrate of an mp3. Obviously  
it would be nice if I could do it in the same place as the MIME type,  
byte size, etc. However, I can't find any way to get data in there.

Is this possible / desirable / should I be doing something else?

thank you,

Sho


Re: Write metadata inside _attachments?

Posted by Sven Helmberger <sv...@gmx.de>.
Jan Lehnardt wrote:
> 
> On 18 Feb 2009, at 10:45, Sho Fukamachi wrote:
> 
>> Hi Couchists,
>>
>> Having in some cases multiple attachments per document, I would like 
>> to be able to store some metadata next to each attachment - the 
>> width/height of a picture, for example, or the bitrate of an mp3. 
>> Obviously it would be nice if I could do it in the same place as the 
>> MIME type, byte size, etc. However, I can't find any way to get data 
>> in there.
>>
>> Is this possible / desirable / should I be doing something else?
> 
> This is not currently possible but I think this sounds interesting.
> It came up with CouchApp where we want to store checksums
> with the files (although this feature is no longer needed with per-
> attachment ETags). hmm. I'm worrying a bit about the underlying
> data storage changes. This would effectively a document within
> a document and I don't know how flexible the attachment meta
> data store is.
> 
> CouchApp solves this now by maintaining a mirrored sub-object
> in the main document that it syncs with the _attachments structure.
> While not really neat, it can be fully automated and put into a library.
> 
> Can you open a issue on JIRA for this so we can discuss this
> on dev@?
> 
> https://issues.apache.org/jira/browse/COUCHDB
> 
> Cheers
> Jan
> -- 

There is still the problem of attachment identity that is also the root 
of https://issues.apache.org/jira/browse/COUCHDB-217 .

There would be an easy solution if this was implemented you just would 
have to add a "attachment_meta" object to your document that maps the 
attachment revision to its metadata.

Regards,
Sven Helmberger


Re: Write metadata inside _attachments?

Posted by Sho Fukamachi <sh...@gmail.com>.
Thanks for the reply Jan. Issue created:

https://issues.apache.org/jira/browse/COUCHDB-259

Yes, I am also currently solving the problem by maintaining a separate  
object as well, but feel it's a little messy and overly complex. I had  
thought it wouldn't be too hard, as the content_type is being stored  
there already, isn't it? I don't know enough about the internals,  
though, so that could be completely wrong.

thanks again,

Sho



On 18/02/2009, at 9:00 PM, Jan Lehnardt wrote:

>
> On 18 Feb 2009, at 10:45, Sho Fukamachi wrote:
>
>> Hi Couchists,
>>
>> Having in some cases multiple attachments per document, I would  
>> like to be able to store some metadata next to each attachment -  
>> the width/height of a picture, for example, or the bitrate of an  
>> mp3. Obviously it would be nice if I could do it in the same place  
>> as the MIME type, byte size, etc. However, I can't find any way to  
>> get data in there.
>>
>> Is this possible / desirable / should I be doing something else?
>
> This is not currently possible but I think this sounds interesting.
> It came up with CouchApp where we want to store checksums
> with the files (although this feature is no longer needed with per-
> attachment ETags). hmm. I'm worrying a bit about the underlying
> data storage changes. This would effectively a document within
> a document and I don't know how flexible the attachment meta
> data store is.
>
> CouchApp solves this now by maintaining a mirrored sub-object
> in the main document that it syncs with the _attachments structure.
> While not really neat, it can be fully automated and put into a  
> library.
>
> Can you open a issue on JIRA for this so we can discuss this
> on dev@?
>
> https://issues.apache.org/jira/browse/COUCHDB
>
> Cheers
> Jan
> --
>


Re: Write metadata inside _attachments?

Posted by Jan Lehnardt <ja...@apache.org>.
On 18 Feb 2009, at 10:45, Sho Fukamachi wrote:

> Hi Couchists,
>
> Having in some cases multiple attachments per document, I would like  
> to be able to store some metadata next to each attachment - the  
> width/height of a picture, for example, or the bitrate of an mp3.  
> Obviously it would be nice if I could do it in the same place as the  
> MIME type, byte size, etc. However, I can't find any way to get data  
> in there.
>
> Is this possible / desirable / should I be doing something else?

This is not currently possible but I think this sounds interesting.
It came up with CouchApp where we want to store checksums
with the files (although this feature is no longer needed with per-
attachment ETags). hmm. I'm worrying a bit about the underlying
data storage changes. This would effectively a document within
a document and I don't know how flexible the attachment meta
data store is.

CouchApp solves this now by maintaining a mirrored sub-object
in the main document that it syncs with the _attachments structure.
While not really neat, it can be fully automated and put into a library.

Can you open a issue on JIRA for this so we can discuss this
on dev@?

https://issues.apache.org/jira/browse/COUCHDB

Cheers
Jan
--