Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 72654 invoked from network); 6 May 2010 09:02:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 May 2010 09:02:59 -0000 Received: (qmail 73992 invoked by uid 500); 6 May 2010 09:02:58 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 73678 invoked by uid 500); 6 May 2010 09:02:58 -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 73670 invoked by uid 99); 6 May 2010 09:02:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 09:02:57 +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 patrick.petermair@openforce.com designates 81.223.107.118 as permitted sender) Received: from [81.223.107.118] (HELO outbound.openforce.com) (81.223.107.118) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 09:02:50 +0000 Received: from [10.200.1.211] (split.openforce.com [10.200.1.211]) by outbound.openforce.com (Postfix) with ESMTPSA id 4795218FF87 for ; Thu, 6 May 2010 11:15:47 +0200 (CEST) Message-ID: <4BE285A6.8030708@openforce.com> Date: Thu, 06 May 2010 11:02:30 +0200 From: Patrick Petermair Reply-To: patrick.petermair@openforce.com User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: user@couchdb.apache.org Subject: CouchDB scenario for web application Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi! We are currently in the planning phase of a new web application and are evaluating CouchDB as our data storage. The application is some kind of timesheet and should help customers track all the time they've spend on different tasks. After reading through the online OReilly book (http://books.couchdb.org/relax/) and the wiki, we are still not sure, how we would go about mapping our domain model to CouchDB. With traditional SQL databases you would use something like Hibernate which would map object relationships with 1:n, n:n etc sql table relationships. Let's say I have a customer object and multiple timePacket objects for each customer. My first thought would be something like this: { "_id":"customer ID", "type":"customer", "name":"John Doe" } { "_id":"timePacket ID", "type":"timePacket", "customer":"customer ID", "from":"01:00", "to":"02:00" } I would save all documents in one DB and differentiate between them through the "type" field. To match each timePacket to a customer, I add a customer field to the timePacket documents (much like a foreign key in RDBMS). Through views I'm then able to get all timePackets for a specific customer. Is this the correct way to implement object relationships in CouchDB? And if not, would would be? Or is this kind of scenario not suited for CouchDB? Also .. we are thinking about creating a new database for each customer - so that nobody can access data from other customers, not even by accident. Since the system should also scale for a large number of customers, does CouchDB support a large number of databases? Let's say we have 10.000 customers, we would then create 10.000 DBs on CouchDB (and obviously configure replication, views, etc. programmatically through REST for each one). Thanks! Patrick