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 <[email protected]> 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
>
>
>
>