Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 50183 invoked from network); 30 Aug 2009 20:24:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Aug 2009 20:24:10 -0000 Received: (qmail 5455 invoked by uid 500); 30 Aug 2009 20:24:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 5406 invoked by uid 500); 30 Aug 2009 20:24:09 -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 5396 invoked by uid 99); 30 Aug 2009 20:24:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Aug 2009 20:24:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of martin@bzero.se designates 83.168.236.118 as permitted sender) Received: from [83.168.236.118] (HELO bzero.se) (83.168.236.118) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Aug 2009 20:23:58 +0000 Received: from [10.0.1.8] (c83-250-4-225.bredband.comhem.se [83.250.4.225]) (authenticated bits=0) by bzero.se (8.14.1/8.14.0) with ESMTP id n7UKNaEH015790 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO) for ; Sun, 30 Aug 2009 22:23:37 +0200 (CEST) Message-Id: <7B8A7655-B750-4B0B-93BB-A48FE8C47A9E@bzero.se> From: Martin Hedenfalk To: user@couchdb.apache.org In-Reply-To: <4A9AD394.20608@sinesignal.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: Would there be a problem with storing documents with this structure? Date: Sun, 30 Aug 2009 22:23:31 +0200 References: <4A9AD394.20608@sinesignal.com> X-Mailer: Apple Mail (2.936) X-Virus-Checked: Checked by ClamAV on apache.org 30 aug 2009 kl. 21.31 skrev Dale Ragan: > Basically I have a document, with an id, rev, type, and Content > keys. The Content key > holds the serialized object that is to be stored for it's value. > Are there any pitfalls > with this design? I have attached a sample below: Hi, I should say I'm in no way an expert, I'm starting to wrap my head around document modelling myself. I've been reading up on couchdb a couple of days now and find it really interesting. Anyway, on to your document. First, why duplicate the manager id? Isn't there a risk of them getting out of sync? I think you will run into many conflicts if subordinates are updated independently. Each subordinate has an id, is there another document with more information about subordinates? In that case, why not have all information in there and connect them with a managerId attribute instead? -martin > { > "|_id|":|"000144df-6f11-49f1-a502-e0dab3592326"|, > "|_rev|":|"1-308931e16105b566e1fb48106c85116e"|, > "|type|":|"Manager"|, > "|Content|": { > "|Subordinates|": [ > { > "|Address|": { > "|Street|":|"123 Somewhere St."|, > "|City|":|"Kalamazoo"|, > "|State|":|"MI"|, > "|Zip|":|"12345"| > }, > "|Hours|":|40|, > "|Id|":|"6bcdea2f-2439-4785-ab59-2ee612435705"|, > "|Name|":|"Bob"|, > "|Login|":|"bbob"| > }, > { > "|Address|": { > "|Street|":|"123 Somewhere St."|, > "|City|":|"Kalamazoo"|, > "|State|":|"MI"|, > "|Zip|":|"12345"| > }, > "|Hours|":|40|, > "|Id|":|"b0d156c9-ea3f-4c4f-b49d-ab19bff64dd8"|, > "|Name|":|"Alice"|, > "|Login|":|"aalice"| > }, > { > "|Address|": { > "|Street|":|"123 Somewhere St."|, > "|City|":|"Kalamazoo"|, > "|State|":|"MI"|, > "|Zip|":|"12345"| > }, > "|Hours|":|20|, > "|Id|":|"12b6dbbc-44e8-43c2-8142-11fc6c1d23df"|, > "|Name|":|"Eve"|, > "|Login|":|"eeve"| > } > ], > "|Id|":|"000144df-6f11-49f1-a502-e0dab3592326"|, > "|Name|":|"6"|, > "|Login|":|"6-login"| > } > } > > Basically the content is a Manager type object with an Id, Name, > Login, and Subordinates. > Subordinates are Worker's with an Id, Name, Login, Hours, and an > Address. The _id and the Id of > the Manager object are the same. Basically the Document object is > just a wrapper around what is > given to be persisted. > > Thanks, > > Dale >