type Customer {
id: ID!
personal_name: Name
father_name: Name
phone: [Phone]
}
type Name {
id: ID!
first_name: String!
last_name: String!
middle_name: String
full_name: String!
}
type Phone {
id: ID!
number: String
}
if the customer have same phone number it should point to same node but for me new nodes are getting created.
Hey @Deepak_Sharma,
Can you please share the mutation that you’re trying?
{
"set":[
{
"dgraph.type":"Customer",
"personal_name":{
"first_name": "Deepak",
"last_name": "Sharma",
"middle_name": "",
"full_name": "Deepak Sharma"
},
"phone":{
"number":"9513351889"
}
},
{
"dgraph.type":"Customer",
"personal_name":{
"first_name": "Deepak1",
"last_name": "Sharma1",
"middle_name": "",
"full_name": "Deepak1 Sharma1"
},
"phone":{
"number":"9513351889"
}
}
]
}
@matthewmcneely the motive is if the phone number already exits it should create edge to that type should not create a new node. can you help me with this
Right. The issue here is that the phone
predicate is a simple list, people often confuse them for sets, but they are “stupid” arrays. Have a look at this thread for some discussion and a possible solution: How can I append element to array wiht graphql - #4 by matthewmcneely