couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Unkovsky <>
Subject Re: About _id generation rule
Date Mon, 21 Feb 2011 00:59:38 GMT
As I can grasp in src/couchdb/coudh_uuids.erl, dependent on chosen
uuids algo in config you either take
a) random 16 bytes;
or b) 14 hex-microseconds digits catenated with 9 randomly generated bytes;
or c) 13 bytes of semi-constant prefix concatenated with 6 hex digits
incremented by rand(1,0xffe), where prefix is randomly updated once
total increment is greater than 0xfff000.

No other kind of tricks. I'd just make sure my ids would not easily
overlap, probably java uuids should be good enough.

On 20 February 2011 21:48, sleepnova <> wrote:
> Ha, I know the host uuids request trick.
> But it doesn't solve my problem, I need to generate it offline.
> Right now I use Java API to generate UUID and strip all "-" in it to
> make it looks like an _id generated by CouchDB.
> But I wonder if this approach is good enough, or there are some better
> way to make my _id more appropriate.
> Because I don't know if Couch plays any trick on the auto generated
> _id that could make some different to the internal storage.
> 2011/2/21 Bill Barry <>:
>> On Sun, Feb 20, 2011 at 11:19 AM, sleepnova <> wrote:
>>> Hi,
>>> Does any one know what is the CouchDB _id generation rule?
>>> I'd like to generate it from my client.
>> Not to directly answer your question because I don't know how CouchDB
>> generates the UUIDs, but any UUID generator should work. You can also
>> request them from the host using a GET to /_uuids  or if you want 10 of
>> them   /_uuids?count=10
>> Bill
> --
> - sleepnova


View raw message