How to stop duplication when streaming data into Neoj4

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
      statement: """
      MERGE (S:Customer {id:$id, device:$device}) RETURN S
  MergeIPAddress(ip: String!): IPAddress
      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.

Hi @werner - yes, we should really expose the option of using MERGE in the generated mutations. This has come up a few times, and we've discussed a few options here: Use MERGE instead of CREATE in mutations · Issue #83 · neo4j-graphql/neo4j-graphql-js · GitHub

Would you mind adding your thoughts to that Github issue?

1 Like

Hey @William_Lyon - thanks for the speedy reply will add my question/ thoughts on git.