Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 79974 invoked from network); 15 Nov 2009 08:15:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Nov 2009 08:15:51 -0000 Received: (qmail 22736 invoked by uid 500); 15 Nov 2009 08:15:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 22680 invoked by uid 500); 15 Nov 2009 08:15:49 -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 22670 invoked by uid 99); 15 Nov 2009 08:15:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Nov 2009 08:15:49 +0000 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 b.candler@pobox.com designates 64.74.157.62 as permitted sender) Received: from [64.74.157.62] (HELO sasl.smtp.pobox.com) (64.74.157.62) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Nov 2009 08:15:37 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 44EBC9EF3C; Sun, 15 Nov 2009 03:15:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:message-id:references:mime-version:content-type :in-reply-to; s=sasl; bh=l8TmO3ysOkXWyk4VCfNGxqVG6C4=; b=sF8h7HC UpWtC83En1kQZO6G6JovUKqVvmJlW7c/167IOyPpw7vVm4/0xUwI/ImfmaYxMktW jpcwTJ7ehbTb1Nqt4aAKDey029rB1S0R859RxZ/qSDbcGqGNZWWC7oONTm6J+yo+ HXOEBJwDmA0IKSo/VLJHuNrLgK5V/nwcG7cg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=date:from:to:cc :subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=sasl; b=B65oU6Hth92n8WpT5LOAbKtiX6cHp2V3O IeoBn7S+EWyCFVxfBOz2ajDD5r9Mj2n88kmG+slG1RcFmDolcG6z8ZAPUXrE6Nv9 mtkNElIAk97WS6dHcvA3qyEzAxe0d3Wl3B7kuvKTfTW9fmCfQQ5lAtBxnjDVes7C UyE/nqkQ90= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 3344B9EF3B; Sun, 15 Nov 2009 03:15:14 -0500 (EST) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 9FC689EF3A; Sun, 15 Nov 2009 03:15:12 -0500 (EST) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1N9aGM-0001rB-7D; Sun, 15 Nov 2009 08:15:10 +0000 Date: Sun, 15 Nov 2009 08:15:10 +0000 From: Brian Candler To: Adam Wolff Cc: user@couchdb.apache.org Subject: Re: Ensuring unique attributes across documents? Message-ID: <20091115081510.GA7039@uk.tiscali.com> Mail-Followup-To: Adam Wolff , user@couchdb.apache.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: 004C81DE-D1BF-11DE-90ED-EF34BBB5EC2E-28021239!a-pb-sasl-sd.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Nov 13, 2009 at 08:35:43AM -0800, Adam Wolff wrote: > I know it's uptight (not relaxed) to worry about multiple users > claiming the same email address, but for some apps, it's important to > disallow it. But in this case there are more relaxed solutions. For example - suppose on signup you send a user an E-mail containing an activation link to confirm that the person who claimed that E-mail really is that person. Then if by some fluke or race condition you get two accounts which claim the same E-mail, then you know it must actually be the same person twice. Therefore you can just ignore the subsequent signups. When you find a user by their E-mail address, you just take the first row returned (use :limit=>1). With time-based UUID generation this will be the first time they signed up. You can do a periodic sweep looking for multiple occurrences of the same username if you want to tidy up the database. B.