Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 56023 invoked from network); 9 Mar 2009 18:24:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Mar 2009 18:24:30 -0000 Received: (qmail 76349 invoked by uid 500); 9 Mar 2009 18:24:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 76310 invoked by uid 500); 9 Mar 2009 18:24:27 -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 76299 invoked by uid 99); 9 Mar 2009 18:24:27 -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:24:27 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of awolff@gmail.com designates 209.85.198.237 as permitted sender) Received: from [209.85.198.237] (HELO rv-out-0506.google.com) (209.85.198.237) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Mar 2009 18:24:21 +0000 Received: by rv-out-0506.google.com with SMTP id f6so1729075rvb.35 for ; Mon, 09 Mar 2009 11:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=GBrT4LL7FfWB77t0KCIhVXtkCVXDMFGROBSbSLXIHCA=; b=PgU6t4YjL9inpoOXlFCsQjVXWo5BxHkJWXVTHt74HrwzkmxU6qZVMu4SjI+KQaE238 85LCKTmufsAPzjf8bkxOw8pcP7jBtdcGgYedrByCEUVaqdkM/poC7r25WyvGnQFbDiv2 f7IkdztZ2WNLChUHuIy693MByHHcksaCabEO0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=EKpi7SpKM0IEpdpZO76nQAclutdixIGkIV+Gyu/heKqIVimfKxM/X4oILsu2gimBYH XQjO9TgG0eyZGGi6lsVSfaIhpUhsXA/ObrbZtpG35Ny/3qlwqyBRQ0VMesNsq6T05w9i UDYcjUPv6YM5dCcOEK8kopw11wv+WacmxkHik= MIME-Version: 1.0 Received: by 10.114.192.17 with SMTP id p17mr3663597waf.196.1236623040684; Mon, 09 Mar 2009 11:24:00 -0700 (PDT) In-Reply-To: <6776036A-BA46-42BB-B5A1-E89528EA80E2@apache.org> References: <6776036A-BA46-42BB-B5A1-E89528EA80E2@apache.org> Date: Mon, 9 Mar 2009 11:24:00 -0700 Message-ID: Subject: Re: couchdb commit hooks From: Adam Wolff To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016364c5db90fa2d70464b3bd3b X-Virus-Checked: Checked by ClamAV on apache.org --0016364c5db90fa2d70464b3bd3b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks for the reply damien! This led us directly to a solution. We had been thinking of the id as a function of the user, but it should be the other way around. On a side/related note, is there a spec for the couch-generated ids? How can I write an id that I know will never be generated automatically by couch? Thanks again, A On Mon, Mar 9, 2009 at 11:00 AM, Damien Katz wrote: > 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 >> > > --0016364c5db90fa2d70464b3bd3b--