How to keep entity unique?

New to DGraph,
I try to build my first demo with go client, and I am very confused about how dgraph keeps the entity unique.
I found here is external id could do that, but I think that means I need another db to store ( xid -> uid). Am I right?

Hi,

Dgraph does not support external IDs and recommend storing them as properties (in case if you have external Id that you wanted in Dgraph). So I assume this is not your case. Dgraph assigns UIDs for every entity and you can use blank identifiers to let Dgraph assign a new UID. So the best way for applications to ensure uniqueness is to query and then mutate within a transaction, see upserts for more information.

Sai

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.