Multiple ID issue

+1 for adding the @unique directive to interface.

I am using uuid: String@id on interface and was surprised that the add mutation for different types of that interface would be possible even the same ‘unique’ uuid was provided.


I found the error message for mutations with linked interface where multiple types with the same uuid existed a bit confusing (because it mentions the invisible/ internally used ID and not the conflicting uuids):

“message”: “mutation addPost failed because Found multiple nodes with ID: 0x63aaa”

# schema
interface post { uuid: String! @id }
type blogpost implements post { links: [post]}
type comment implements post {}

# previously added data
{ type: blogpost, uuid: 123}
{ type: comment, uuid: 123}

# new mutation
addBlogpost(uuid: x, links: [123])
# results in confusing error msg: "Found multiple nodes with ID 0x63aaa"
# better error msg: "Found multiple nodes with uuid 123"

Hi @johannes, this id you are seeing here is actually a uid, that is internally used by Dgraph.
And when we try to add the nodes, Dgraph searches the existing nodes with given @id field and if multiple such nodes are found then it return error with dgraph uid instead of @id.
We will change this error message and also consider this scenario while adding @unique directory.
Thanks for bringing this up.