From user-return-3958-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Mar 09 18:01:32 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 35658 invoked from network); 9 Mar 2009 18:01:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Mar 2009 18:01:32 -0000 Received: (qmail 16176 invoked by uid 500); 9 Mar 2009 18:01:29 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 16137 invoked by uid 500); 9 Mar 2009 18:01:29 -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 16126 invoked by uid 99); 9 Mar 2009 18:01:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Mar 2009 11:01:29 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.68.5.16] (HELO relay02.pair.com) (209.68.5.16) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 09 Mar 2009 18:01:21 +0000 Received: (qmail 88851 invoked from network); 9 Mar 2009 18:00:59 -0000 Received: from 96.33.90.152 (HELO ?192.168.1.195?) (96.33.90.152) by relay02.pair.com with SMTP; 9 Mar 2009 18:00:59 -0000 X-pair-Authenticated: 96.33.90.152 Message-Id: <6776036A-BA46-42BB-B5A1-E89528EA80E2@apache.org> From: Damien Katz To: user@couchdb.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: couchdb commit hooks Date: Mon, 9 Mar 2009 14:00:59 -0400 References: X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Unless you need sequential numbers, you could just generate the desired IDs client side and save and let conflict detection handle if it's non-unique. If you get a conflict error, then client must generate another ID. Repeat until successful. -Damien On Mar 9, 2009, at 1:31 PM, Adam Wolff wrote: > Hi everyone,We're psyched about couchdb and are planning to use it > in our > production system. We have a nice model for documents in our system > that > builds directly off of the features of couchdb and makes a lot of > sense. > However, we're not sure how to use couchdb to handle users. > > The problem boils down to the difficulty in handing out unique user > ids. We > understand that introduction of an AUTO INCREMENT behavior would add > global > shared state to the db, but right now it doesn't seem like you can > handle > this use case with the existing features of couchdb. (If I'm wrong > about > that PLEASE correct me!) We have implemented an act-then-check > procedure for > this for now, but the unpredictability of http request ordering > stills means > that there can be periods of inconsistent state. > > I'm wishing for a function that could live in couch that could be > called to > generate an ID for a new document. This could return the date/time > or the > server node name or whatever. I'm sure I haven't thought through the > potential difficulties here, but I'm curious about the thinking on > this, or > whether these features are planned, or whatever. > > In the long term, if the couch features don't change, I think we'll > have to > use a SQL store for users and couch for documents, but that would > dramatically increase the complexity of the system. > > Thanks in advance, > A