couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anh <7za...@gmail.com>
Subject Re: Two kinds of Attachments in doc
Date Fri, 30 Apr 2010 01:51:50 GMT
Your first approach would work, or you could also create an additional
document for one attachment, which has a "type" property.

For example:

{
   "_id": "mytrack.mp3"
   "_attachments": {
      "file": {content_type: ''}
   }
}

{
   "_id": "super_cover.png",
   "song": "mytrack.mp3"
   "type": "cover",
   "_attachments": {
      "file": {content_type: ''}
   }
}

"Splitting" it like this may offer some additional flexibility for views, etc.
Hard to say without knowing the use-cases better.

Hope this helps.


On Thu, Apr 29, 2010 at 11:11 AM, faust 1111 <faust451@gmail.com> wrote:
> It's not simple to me,
> to get url for attach i must parse _attachments.each.content_type == /^image/
>
>
>
> 2010/4/29 Randall Leeds <randall.leeds@gmail.com>:
>> content_type starts with image/ it's the cover, if it starts with
>> audio/ it's the track?
>>
>> On Thu, Apr 29, 2010 at 10:37, faust 1111 <faust451@gmail.com> wrote:
>>> Hi guy's
>>>
>>> I need modeling this:
>>>
>>> Audio
>>>  has_attachment
>>>    cover_img
>>>    trac_mp3
>>>
>>> {
>>>  _attachments: {
>>>     'super_cover.png': {content_type: ''},
>>>     'my_track.mp3': {}
>>>  }
>>> }
>>>
>>> how later i can identify, which file is cover and which is track?
>>> Now i have only this idea:
>>>  store file name in additional field cover_attach_name, trac_attach_name.
>>>
>>> But may be another way?
>>>
>>
>

Mime
View raw message