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.

GraphQL & Neo4j : how to modify a property with a mutation request?

LJRB
Graph Buddy

I have article nodes in a Neo4j database. One of his property is a boolean: "saved: false". The property name of this node is "saved".

I have a React interface where I want users to be able to save articles as favorites. So what I would like to do is change the property "saved" to true when they want to save an article or set to false when they want to cancel the favorite.

This process can be done with a graphql request but I don't know how to write my request to modify a node property.

Example: The user wants to save the article with id = 1, so he clicks on the button "favorite" and the article node property id = 1 and the node property "saved" goes from false to true.

I just want to update a node property, like this I think:

type Mutations {
    saved(article:ID!) : ??? (string ?)
      @cypher(statement:"MATCH (a:Article {id: $id, saved:$saved})
                         SET a.saved += true ")
}
schema {
   mutations: Mutations
}

How can I do it ?

2 REPLIES 2

Hello @LJRB! I've created a new neo4j-graphql-js issue to respond to this, hopefully we can figure out the right mutation 🙂

Hello @michaeldgraham thank you for the response