neo4j-graphql-java icon indicating copy to clipboard operation
neo4j-graphql-java copied to clipboard

Support to auto generate IDs

Open Andy2003 opened this issue 3 years ago • 0 comments

Support an @autogenerate directive which assigns an UUID on creation.

Schema would look like:

type Movie {
    id: ID! @autogenerate
    name: String!
}

GraphQL input:

mutation {
    createMovies(input: [{ name: "dan" }]) {
        movies {
            id
            name
        }
    }
}

Generated cypher

CALL {
  CREATE (this0:Movie)
  SET this0.id = randomUUID()
  SET this0.name = $this0_name
  RETURN this0
}

RETURN this0 { .id, .name } AS this0

Andy2003 avatar Mar 05 '21 14:03 Andy2003