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 F31BB91EB for ; Wed, 9 May 2012 21:32:05 +0000 (UTC) Received: (qmail 12071 invoked by uid 500); 9 May 2012 21:32:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 11963 invoked by uid 500); 9 May 2012 21:32:04 -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 11955 invoked by uid 99); 9 May 2012 21:32:04 -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:32:04 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jens@couchbase.com designates 206.225.164.30 as permitted sender) Received: from [206.225.164.30] (HELO EXHUB020-3.exch020.serverdata.net) (206.225.164.30) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 21:31:58 +0000 Received: from EXVMBX020-1.exch020.serverdata.net ([169.254.4.3]) by EXHUB020-3.exch020.serverdata.net ([206.225.164.30]) with mapi; Wed, 9 May 2012 14:31:36 -0700 From: Jens Alfke To: "user@couchdb.apache.org" Date: Wed, 9 May 2012 14:31:35 -0700 Subject: Re: include_docs with _all_docs Thread-Topic: include_docs with _all_docs Thread-Index: Ac0uKxyHC/MkxMi7Ra+6im4E8198jg== Message-ID: <7CC02CFB-C515-478C-813C-274859EE5D4B@couchbase.com> References: <7caa2578e04507ec25f97df01e5d66ab.squirrel@secure61.inmotionhosting.com> <2ba5948b99a136aebad13e1cfcd8b525.squirrel@secure61.inmotionhosting.com> In-Reply-To: <2ba5948b99a136aebad13e1cfcd8b525.squirrel@secure61.inmotionhosting.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 befor= e writing code to operate on it. CouchDB doesn=92t enforce any schema, but = you=92d generally define what properties you put in documents beforehand. What kind of program are you writing? I=92m not an RDBMS guru but I=92ve wr= itten some apps that use SQL databases, and I haven=92t had to introspect t= he metadata of the table columns. I=92ve defined my tables and then written= my queries using the columns I defined. Keep in mind that, to some degree, it doesn=92t make sense to ask =91what a= ttributes exist in the database=92 because every document could have a diff= erent set of attributes. It=92s very unlikely but possible. CouchDB has not= hing comparable to =91columns=92 in SQL; every document is an independent b= ag 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 th= e presence of that attribute, or any structure you want your documents to h= ave. > 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 calle= d > "telephone", which is now an attribute of an attribute or meta-attribute)= ? I really have no idea where you=92re going with this. It=92s awfully abstra= ct. What are you trying to accomplish? =97Jens=