Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 29257 invoked from network); 13 Jan 2009 01:36:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jan 2009 01:36:21 -0000 Received: (qmail 53740 invoked by uid 500); 13 Jan 2009 01:36:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53705 invoked by uid 500); 13 Jan 2009 01:36:19 -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 53690 invoked by uid 99); 13 Jan 2009 01:36:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2009 17:36:19 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 209.85.132.250 as permitted sender) Received: from [209.85.132.250] (HELO an-out-0708.google.com) (209.85.132.250) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jan 2009 01:36:10 +0000 Received: by an-out-0708.google.com with SMTP id b2so3241238ana.5 for ; Mon, 12 Jan 2009 17:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=KvxDFgkbXB7M7rPRCSnKBUzZdp7hlrKqBuy/DViYwJ8=; b=PNuV1lz1qCOoepd5ILlddafEK9D/MNSIgtXENV6iEJru8jpVZq7RkQj52NkN3GL+Ow N1VDprZCWeOnJy+XH4QM4Rl7QdvmPyPIkR0PrS6pDK7YYmUOwQJVTSTPAfBbumotscsa s4PZMOakF0bPn601w12uCbJSuYdyd5LuKWf+s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Xa59JFaAnjqYAvjFuqMutMT2bvAMVmOO5GwHRjQ0CWpKa9nUCwsEOQCvtPVV01pyF1 hLUTis3izsdjvOKt3y49NFHsKKf6H2wHvclc27nGJF8AhjzCmbS1JKfUg8DeXiAl03S7 TBOLx0w/SSlpj8EAoFuVBrj3BEUkc9zDqMS+0= Received: by 10.64.220.20 with SMTP id s20mr20344973qbg.47.1231810548629; Mon, 12 Jan 2009 17:35:48 -0800 (PST) Received: by 10.65.158.2 with HTTP; Mon, 12 Jan 2009 17:35:48 -0800 (PST) Message-ID: Date: Mon, 12 Jan 2009 17:35:48 -0800 From: "Chris Anderson" To: user@couchdb.apache.org Subject: Re: Can I guarantee uniqueness in a field without using _id? In-Reply-To: <20090113011256.GN11136@translab.its.uci.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <518815b70901111530o23f6ce31yb40f974ea85467c0@mail.gmail.com> <25893274-A543-4F9A-9FE3-A8E93938051B@apache.org> <518815b70901121417ldf0d691l2838488fd5684697@mail.gmail.com> <518815b70901121505l2fd3fc21uab28dcdaf419103c@mail.gmail.com> <20090113011256.GN11136@translab.its.uci.edu> X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Jan 12, 2009 at 5:12 PM, James Marca wrote: > It always strikes me > as a bit of a hack to overload the _id just to use its uniqueness > features. But given that one *can* get unique fields, I'd guess there > are other things for the developers to solve first. Supporting multiple unique keys would not lead us closer to the goal of getting CouchDB to provide its current HTTP API, even when run across a partitioned cluster of very many nodes. The same story that applies about global state and uniqueness outside of CouchDB also applies inside. The magic of hash functions allow us to provide a single uniqueness constraint. If you need multiple distinct unique keys, you'll need to track them as separate documents, and deal with race conditions in your application. (There may be a hack to get the _bulk_docs API to help you a little here, but it might be that _bulk_docs transactions will have go away for the sake of scalability.) Eventually consistent cluster transactions will be a good challenge for client libraries. I can understand the value you find in using multiple keys, but the best way to get your application into Couch will be design it for standalone documents. I'm glad it looks like you can get by without multiple keys, there's a lot you can do with application-controlled ids. -- Chris Anderson http://jchris.mfdz.com