Unique Constraint on attributes

I need to create a Unique constraint based on some attributes.
I went through documentation of couchbase and I see only available option is document lookup.
Do we have any other way where we can introduce unique constraint based on attributes ?

Hi @dileep_as,

The thread’s a bit old, but check out: Can i do unique constraint on some attribute not the id for a workaround involving compound document keys with a “lookup document”.

Another feature that’s been added to Couchbase since then that might work, depending on your use case, is Eventing. Create a function that will check for uniqueness in a “staging” bucket and then copy to the “live” bucket when appropriate.

1 Like