I am dealing with different methods of creating uniqueness over a graphql interface
currently where using neo4j-graphql-js which features auto-generated mutations for graphql types in neo4j
under the hood it's really just translating e.g. create mutations to a cypher CREATE
query
which is why duplicates can occur
busy using
e.g. using CONSTRAINT
or MERGE
i was thinking about forking the lib and extend the auto-generation method with MERGE
but maybe there is something more elegant
type Mutation {
MergeCustomer(id: ID!, device: String): Customer
@cypher(
statement: """
MERGE (S:Customer {id:$id, device:$device}) RETURN S
"""
)
MergeIPAddress(ip: String!): IPAddress
@cypher(
statement: """
MERGE (S:IPAddress {ip:$ip}) RETURN S
"""
)
...
}
but in a streaming fashion it's difficult to maintain a consistent db state as duplicate values are constantly flooding in.