couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Davis" <>
Subject Re: Does CouchDB check autogenerated document id's?
Date Fri, 02 Jan 2009 15:55:21 GMT

Depends on what you mean:

When saving, if a document happened to get an auto-generated DocID
that already existed it'd throw a 412 precondition failed error. This
would be the same error you'd get if you retrieved a doc, deleted it's
_rev member and tried saving.

On the other hand, if you request a set of id's from the _uuids
endpoint, they aren't checked against the current DB to enforce
uniqueness (which would be a race condition anyway).

Also remember that if you ever get an autogenerated ID collision then
something is most definitely broken. For an example of a similar
situation, see the Ubuntu OpenSSL bruhaha with public key collisions.

Paul Davis

On Fri, Jan 2, 2009 at 10:34 AM, A.J. Brown <> wrote:
> Hi all,
> I'm writing a proof of concept for our organization to use couchdb for our content. 
Part of the task will be generating document Ids from legacy Ids (autonumber integers).  
 This would be done by simply doing an md5() hash on the legacy id.
> Since we're storing the same 32char hex string as our user-provided document ids, When
CouchDB generates an Id for a new document, will it make sure that ID doesn't exist first?
 I know the chances of generating the same exact ID are slim to none, but the question still
> --
> A.J. Brown

View raw message