Hello, I am new with Dgraph. Now I am trying to make it a part of ETL process and import some data in Dgraph database.
From the documentation I learnt that setting @id directive in my schema allows me to avoid duplicates on mutations:
https://dgraph.io/docs/graphql/schema/ids/
Dgraph requires a unique username when creating a new user. It generates the input type for
addUser
withusername: String!
, so you can’t make an add mutation without setting a username; and when processing the mutation, Dgraph will ensure that the username isn’t already set for another node of theUser
type.
So that one drew my special attention: “Dgraph will ensure that the username isn’t already set for another node of the User
type”
So I created schema:
type Experiment {
uuid: String! @id
name: String
}
Then I run following mutation in Ratel:
{
"set": {
"dgraph.type": "Experiment",
"Experiment.name": "Dock",
"Experiment.uuid": "1000"
}
}
I do it twice by let’s say … by mistake,
and when I request for Experiment nodes, I have two!
{
"uid": "0x13881",
"Experiment.name": "Dock",
"Experiment.uuid": "1000"
},
{
"uid": "0x13882",
"Experiment.name": "Dock",
"Experiment.uuid": "1000"
}
]
Despite uuid is already set, ratel added two records!
Does that mean that Dgraph does not ensure that Experiment.uuid already exists?