cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to stop duplication when streaming data into Neoj4

werner
Node Clone

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.

2 REPLIES 2

William_Lyon
Graph Fellow

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: https://github.com/neo4j-graphql/neo4j-graphql-js/issues/83

Would you mind adding your thoughts to that Github issue?

werner
Node Clone

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

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online