Document ID uniqueness by bucket or cluster?

Hi,

Are document ids, as referenced by META().id in N1QL, unique by cluster or by buckets? I.e. if there are two buckets on the same cluster, is it possible in theory for documents in different buckets to have the same document ID?

Thanks.

DocumentIds are unique by bucket.

1 Like

@clinton1ql

Thanks for your quick reply!

It’s what I guessed, but just wanted to be sure. :slight_smile:

A seperate, but related question :

Is it possible to guarantee that document IDs won’t ever change, even after an upgrades/failures?

I would like to use document IDs as a kind of universal ID method, but that might be problematic if they could ever change, even in fringe cases.

Yup, the document ID is the unique identifier for the document - sort of like the primary key in RDBMS.
It’s not going to change during upgrades or failures by itself.

1 Like

@clinton1ql

Many thanks for your quick replies!