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 create mutation to create relations using makeAugmentedSchema

Dears,

I could create all queries and mutations to query/create/update/delete nodes using makeAugmentedSchema

Can you please help to share your knowledge and some samples how mutations can be created using makeAugmentedSchema( with out using makeExecuteableSchema and resolvers).

Thanks in advance!

1 REPLY 1

MuddyBootsCode
Graph Steward

I do quite a few of my mutations, especially group mutations with custom Cypher queries such as:

cloneLeaseClauses(leaseID: ID!, clauses: [ID]!): Lease
 @cypher(
statement: 
"MATCH (l:Lease {id: $leaseID})
WITH l as lease UNWIND $clauses as info
MATCH (n:Clause {id: info}) call apoc.refactor.cloneNodes([n], false, ['id'])
yield output set output.id = randomUUID() 
MERGE (lease)-[:CLAUSE]->(output) return lease"
    )

This allows you to get custom behavior from cypher as well as custom return types. I hope that helps.