incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Referential Integrity with Unique IDs
Date Tue, 25 Aug 2009 18:24:17 GMT
On Tue, Aug 25, 2009 at 2:17 PM, Adam Wolff<awolff@gmail.com> wrote:
> I thought the point of uuids was that you could just make one up and assume
> that it's unique.
> A
>

Well, the point is to have a UUID's is to have universally unique
identifiers that don't require a central authority. There are a couple
algorithms for achieving that goal. Though I don't see the connection
between that and this thread. DocID's can be UUID's, and UUID's are
useful because you don't have to worry about collisions, but there's
nothing stopping you from having a central authority assign
incrementing integer id's.

HTH,
Paul Davis

> On Tue, Aug 25, 2009 at 7:39 AM, Paul Davis <paul.joseph.davis@gmail.com>wrote:
>
>> The only way to make absolutely certaint that something is unique is
>> to include it in the document id in some fashion.
>>
>> I generally solve this with sha1's for docids and then reference those
>> ids from the doc. Depending on the size of your unique value, it may
>> be beneficial to include a copy inline.
>>
>> HTH,
>> Paul Davis
>>
>> On Tue, Aug 25, 2009 at 10:21 AM, Jan Vincent
>> Liwanag<jvliwanag@gmail.com> wrote:
>> > Hi guys,
>> >
>> > For some document type, I have some property 'x' which I'd like to be
>> unique
>> > across all records. However, the value for this property may change.
>> >
>> > The way I see it is that I have two options. If I derive the id from this
>> > property 'x', then I am assured of its uniqueness. However, I cannot
>> easily
>> > change the value for property 'x', as the value of the id depends on it.
>> > Moreover, I may have to update all records which refers to it.
>> >
>> > If I use a uuid however, referential integrity is retained. However, I'm
>> not
>> > sure if CouchDB alone can make sure that the value for that property is
>> > unique.
>> >
>> > Any thoughts on this?
>> >
>> > Thanks,
>> >
>> > JV Liwanag
>> >
>>
>

Mime
View raw message