Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 53992 invoked from network); 6 Jul 2010 04:42:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Jul 2010 04:42:21 -0000 Received: (qmail 5133 invoked by uid 500); 6 Jul 2010 04:42:20 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4886 invoked by uid 500); 6 Jul 2010 04:42:18 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 4872 invoked by uid 99); 6 Jul 2010 04:42:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jul 2010 04:42:16 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [206.190.38.58] (HELO web50304.mail.re2.yahoo.com) (206.190.38.58) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 06 Jul 2010 04:42:07 +0000 Received: (qmail 68602 invoked by uid 60001); 6 Jul 2010 04:40:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1278391246; bh=rVddKrHu16yNwuQWM5s10MsQbUzL01qpcX/rZcecqSA=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=ek87RnulODA00MEOiAZdLtZrLTmuzkNIBqHDjNb5XCVFRbPoqWk032iwrLyrVHEIGnLpfrBCsxSszaiCzVPmgRDfFP5Abry/aAScNSTpJprK5/zOdWPki0BOJgN5XTxCuW84rd7UDZ7jEzn+TTxpJKReucJDAX4WbgY7bPKeUdk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=wOX3Q3FdR/s+Dn5o8W//NCDx0MILSPUcSukipYETSnovYRpkGRm9knpJm09N4GkYd9gNmqhKA/vin4MhtwG+9I+9QBWcEOi7E7a5SYwxz2Fvwu+3oD1Z8hbHfcxRyI/+tBAo12p617eDIHrStAY4cWhc4O2imWrkUb5C30JhGR8=; Message-ID: <177224.67898.qm@web50304.mail.re2.yahoo.com> X-YMail-OSG: rrlUtLwVM1krfbgg_SZHg78Y1cK4FIlP.uZ25OjPb14LJ7D tX9x46wRXSEpY_FAoU.mvqe_Pn9Q.fhdyc.lt4qoMR9nhI54MM8Ymx.avHfQ kVt0y8DK_38.S3jGJju477gm5BYiWBkWzkFCRknO1iCzFlLV3miND6PZPHwh oU3oEVTyywqiEy.BVAfMHY0HnP7vGVb_26ekchmBWpACXQi6pOvG9sQJwNeI IDoHo7KzFYdn9rMH3UeBS2hpABTPSXe56ZgZ1CxbOruwELxk90JpWoAZToAu aduMn9fq_xJSV6mZAAlYtiTzeWEzvGUSLe08xfB24n.lP1pKskINFwAoIpW0 ke4uso1YpxrTWvHVeVQ8uNrKLdA-- Received: from [24.18.44.145] by web50304.mail.re2.yahoo.com via HTTP; Mon, 05 Jul 2010 21:40:46 PDT X-Mailer: YahooMailRC/397.8 YahooMailWebService/0.8.104.274457 References: <536177.27209.qm@web50301.mail.re2.yahoo.com> Date: Mon, 5 Jul 2010 21:40:46 -0700 (PDT) From: Alex Yiu Subject: Re: "_attachements" field name in CouchDB To: user@couchdb.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-858166309-1278391246=:67898" X-Virus-Checked: Checked by ClamAV on apache.org --0-858166309-1278391246=:67898 Content-Type: text/plain; charset=us-ascii 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 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 > > > > --0-858166309-1278391246=:67898--