Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8FCEE1052E for ; Mon, 16 Sep 2013 09:31:10 +0000 (UTC) Received: (qmail 73407 invoked by uid 500); 16 Sep 2013 09:31:03 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 73362 invoked by uid 500); 16 Sep 2013 09:30:44 -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 73346 invoked by uid 99); 16 Sep 2013 09:30:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Sep 2013 09:30:42 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of grobmeier@gmail.com designates 209.85.214.44 as permitted sender) Received: from [209.85.214.44] (HELO mail-bk0-f44.google.com) (209.85.214.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Sep 2013 09:30:36 +0000 Received: by mail-bk0-f44.google.com with SMTP id mz10so1374037bkb.17 for ; Mon, 16 Sep 2013 02:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Hg+VVZd/vAH+mFcg9FOLPEJCX0qN0zzYts962UZzAmw=; b=ZTjiwBo78ggzX+KWJJk/u4nGmuyiVlzfVPob5O7eCLMOz4nkB6LLmnDj6B8iSZ3i5n mX8Lwcglc3c3CLhULR2OGh9W6TgUZmTxzJmn5n/4F7ZQkhxg1Vgp+7CKuU8E7k0tj0F6 sT6nzNbark/5poKMgrUJJMDmz5LhLdJV1+6+r+zEzbWijHXWY6vSMSRVNwvRWOk0RtdF FsyzG1OpYgRmxCkopyyGvRXLMIQ88f4VuEqab7dsV3BO8a7Uro+/p+vfujBoMZbpg3mX f3dQ00a0/lVqyhDbRTDPtBLFXe6Xnwv/3+5iKtPTOgPwvY7PMCSXka28qxtswbtmTx9d Yrtw== X-Received: by 10.204.226.71 with SMTP id iv7mr920217bkb.32.1379323815221; Mon, 16 Sep 2013 02:30:15 -0700 (PDT) Received: from CG-MBPro.local (p4FF9BEA8.dip0.t-ipconnect.de. [79.249.190.168]) by mx.google.com with ESMTPSA id ku9sm7023981bkb.1.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 02:30:14 -0700 (PDT) Message-ID: <5236CFA5.1060509@gmail.com> Date: Mon, 16 Sep 2013 11:30:13 +0200 From: Christian Grobmeier User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Beginners approach of designing documents Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi all, for more than a decade I used relational databases. For a tiny project I would like to try NoSQL and CouchDB and see for myself why people are so fond of it. For me it is not much about tons of data. I am using AngularJS and PHP and thought a schemaless database would fit nicely. While I think I found the approach for most of my app, I am unsure about one specific thing. I would like to enable my users to register and add a book to their personal collection. My approach would be to create a database with books first. Like: {_id: 1, functional:"my-book", title:"my title", ... } Second I would like to create a database with my users, like: {_id: 20, email : "john@example.com", pass : "hashed", salt : "salt", books : [ 1, 2, 3, 4 ...] } When a user logs in, I would like to search for him by email and check user credentials. When it succeeds I would look up all the books in his collection. On the net somebody wrote I should create a database per user. But this seems completely wrong to me. Right? I am a little concerned because I am referencing books from my user object. Is this the right approach? Or do I miss something? Glad over all links, points, hints and so on. Thanks! Christian