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<jvliwa...@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 >