neo4jIDL

Updates your Neo4j-GraphQL schema by calling the graphql.idl procedure.

In order to update your Neo4j-GraphQL schema, you can use the neo4jIDLexport, which sends a request to Neo4j to call the graphql.idlarrow-up-right procedure using the typeDefs you provide.

Block strings in @cypher directives are supported by turning them into single line statements before sending the call to graphql.idl.

API Reference

Example

typeDefs

type Movie @model {
  title: String!
  released: Int
  actors: [Person] @relation(name:"ACTED_IN",direction:IN)
  # computed field
  directors: [Person] @cypher(statement: """
    MATCH (this)<-[:DIRECTED]-(d) RETURN d
  """)
}
type Person @model {
  name: String!
  born: Int
  movies: [Movie] @relation(name:"ACTED_IN")
}
type Query {
  coActors(name:ID!): [Person] @cypher(statement:"""
    MATCH (p:Person {name:$name})-[:ACTED_IN]->()<-[:ACTED_IN]-(co) 
    RETURN distinct co
  """)
}
type Mutation {
  rateMovie(user:ID!, movie:ID!, rating:Int!): Int @cypher(statement: """
    MATCH (p:Person {name:$user}),(m:Movie {title:$movie}) 
    MERGE (p)-[r:RATED]->(m) SET r.rating=$rating 
    RETURN r.rating
  """)
}
schema {
   query: Query
   mutation: Mutation
}

Last updated