incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anh <7za...@gmail.com>
Subject Re: "_attachements" field name in CouchDB
Date Tue, 06 Jul 2010 05:03:33 GMT
"Option #1: really defeats the purpose of having nested JSON objects"

I agree, but do remember that you could use a list function, etc to
"build" a nested json document from multiple docs if that is important
in your use-case.



On Mon, Jul 5, 2010 at 9:40 PM, Alex Yiu <alexyiu@yahoo.com> wrote:
>
>
> Hi,
>
> Option #1: really defeats the purpose of having nested JSON objects
> Option #3: Base64 encoding is not that efficient. Bloated ratio around 1.3x.
>
> I would consider option #2: if CouchDB has no intention to support this feature, that
is I will manually maintain the cross reference relationship between the line and attachments.
e.g. :
>
> [ { "line" : 1, "price": "33.4", "picture" : { "attachmentName" : "picX" } , { "line":
2, ...  } ]
> "_attachments" : {
>  "picX" : ...,
>  ...
> }
>
> Similar to "id" and "ref" concepts.
>
> I would consider my proposal in my original email is a nice to have feature.
>
>
>
> Alex
>
>
>
>
>
> ________________________________
> From: Anh <7zark7@gmail.com>
> To: user@couchdb.apache.org
> Sent: Mon, July 5, 2010 9:14:04 PM
> Subject: Re: "_attachements" field name in CouchDB
>
> Could you consider any of these 3 options?:
>
> 1) A document per line item, and a single standard attachment name
> such as "picture"?
>
> 2) A convention for attachments associated with a series of line items
> in a single doc, such that _attachments contains a corresponding
> series of attachments?  E.g.:
>
> [ { "line" : 1, "price": "33.4" } , { "line": 2 } ]
> "_attachments" : {
>   "picture1" : ...,
>   "picture2" : ...,
> }
>
> 3) Base64 the image into the "picture attachement" as text, and you
> handle the unencoding, etc.
>
>
> Hope this helps.
>
> On Mon, Jul 5, 2010 at 8:36 PM, Alex Yiu <alexyiu@yahoo.com> wrote:
>>
>>
>> Hi, all,
>>
>> I am a newbie to CouchDB. Sorry for a potential newbie question.
>>
>> I am wondering whether we can associate binary attachment to a field name defined
by users, instead of the generic pre-defined "_attachments" field name? If we can do that,
we can manage association between multiple attachments and different parts of the JSON document
easier.
>>
>> For example, if a JSON doc represents a purchase order, a PO can have multiple line
items. Each line item may have optional attachment.
>>
>> [ { "line" : 1, "price": "33.4", "picture attachement" : { ... } } , { "line": 2,
... } ]
>>
>> Within the "picture attachement" object, it contains some special fields to denote
it is an attachement.
>> e.g.  "picture attachement" : { "_attachment_id": "..." , ... }
>>
>> We can do something to that extent already. That is great.
>>
>> If not, do we have a JIRA issue for that already?
>> If we have not that JIRA issue yet, does it worth log an issue there now?
>>
>>
>> Thank you so much for answering this newbie question!!!
>>
>>
>> Alex Yiu
>>
>>
>>
>>
>
>
>
>

Mime
View raw message