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 3DD30928E for ; Wed, 9 May 2012 21:54:02 +0000 (UTC) Received: (qmail 92918 invoked by uid 500); 9 May 2012 21:54:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 92875 invoked by uid 500); 9 May 2012 21:54:00 -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 92867 invoked by uid 99); 9 May 2012 21:54:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 21:54:00 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.124.202.180] (HELO biz61.inmotionhosting.com) (74.124.202.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 21:53:53 +0000 Received: from localhost ([127.0.0.1]:47076 helo=secure61.inmotionhosting.com) by biz61.inmotionhosting.com with esmtpa (Exim 4.69) (envelope-from ) id 1SSEp2-0007qg-A0 for user@couchdb.apache.org; Wed, 09 May 2012 14:53:24 -0700 Received: from 97.54.3.9 ([97.54.3.9]) (SquirrelMail authenticated user dan@danmyersconsulting.com) by secure61.inmotionhosting.com with HTTP; Wed, 9 May 2012 14:53:24 -0700 Message-ID: <3c42307e64dc9ecee1b595858e3b81fe.squirrel@secure61.inmotionhosting.com> In-Reply-To: <7CC02CFB-C515-478C-813C-274859EE5D4B@couchbase.com> References: <7caa2578e04507ec25f97df01e5d66ab.squirrel@secure61.inmotionhosting.com> <2ba5948b99a136aebad13e1cfcd8b525.squirrel@secure61.inmotionhosting.com> <7CC02CFB-C515-478C-813C-274859EE5D4B@couchbase.com> Date: Wed, 9 May 2012 14:53:24 -0700 Subject: Re: include_docs with _all_docs From: dan@danmyersconsulting.com To: user@couchdb.apache.org User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - biz61.inmotionhosting.com X-AntiAbuse: Original Domain - couchdb.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - danmyersconsulting.com X-Source: X-Source-Args: X-Source-Dir: Jens, 1. I'm in data management. There is a strong business case for having robust business descriptions for each column (where it came from, what it means, who entered it, how it's calculated...etc). Risk officers need to analyze what data is in a db that (aka after a developer builds the database and moves on nobody will know what attributes exist--without reverse engineering the application). Business analysts have no way of conducting Business Intelligence without knowing what they are querying. How do you do this without descriptions? 2. Great this is helpful, I'll research more. 3. Trying to accomplish what is discussed in #1, but at the "column" level. How would I count (or any other business analytic) tweets from people in US, Japan, Brazil if my docs are tweets by IP, Country, Date? How do I know that all tweets have "Country" on them if there isn't any metadata to say so? If the follow-up business question is what the counts are by country by day, how do I form a query by "Date" if I don't know that the "column" for date even exists without metadata? > On May 9, 2012, at 1:21 PM, > wrote: > >> 1. If I don't know what attributes exist in the database there is no way >> to write a query about those attributes on documents. > > Usually you know something about the schema of the data in a database > before writing code to operate on it. CouchDB doesn�t enforce any schema, > but you�d generally define what properties you put in documents > beforehand. > > What kind of program are you writing? I�m not an RDBMS guru but I�ve > written some apps that use SQL databases, and I haven�t had to introspect > the metadata of the table columns. I�ve defined my tables and then written > my queries using the columns I defined. > > Keep in mind that, to some degree, it doesn�t make sense to ask �what > attributes exist in the database� because every document could have a > different set of attributes. It�s very unlikely but possible. CouchDB has > nothing comparable to �columns� in SQL; every document is an independent > bag of JSON. > >> 2. If I create my own attribute of a document which stores metadata for >> that document it works but if that metadata attribute isn't a required >> attribute for all docs then how can I enforce the collection of metadata >> which supports #1 above? > > You can add a validation function to a design document that will enforce > the presence of that attribute, or any structure you want your documents > to have. > >> 3. I can create a attribute that would provide a description of a >> document, e.g.#2 above (aka metadata) but how do I create an attribute >> of >> a document attribute? (e.g. an description for a document attribute >> called >> "telephone", which is now an attribute of an attribute or >> meta-attribute)? > > I really have no idea where you�re going with this. It�s awfully abstract. > What are you trying to accomplish? > > �Jens