couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: Ensuring unique attributes across documents?
Date Sun, 15 Nov 2009 08:15:10 GMT
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.


View raw message