Referencing foreign UIDs in dgraph

Hi all,

What is the best way to reference a UID in one Dgraph instance from another? Is it possible to reference the foreign UID in a literal like this?:

mutation {
  schema {
    foreignUid: uid @index .

Or is the Dgraph “uid” type reserved to point only at entities?

NOTE: my previous post seemed unclear, so hopefully this makes more sense.

@tamethecomplex Hey the uid type is reserved only to point at other entities. By instance do you mean another dgraph running separately ? If you want same id’s across multiple dgraph instances then you need to model it as another edge and index it.(may be int or string depending on your uid generation)

1 Like

@janardhan Hey, thanks for the fast response. Yes, exactly, another dgraph running separately.

I guess since the underlying type of uid is uint64, I can’t safely store it in a dgraph type int, which is int64 which has half the positive numeric range?

Sounds like in this case, the best course of action is to store the foreign uid in an indexed dgraph “string” scalar type.

Thanks again!

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