Article DetailsDetailsHelp DetailsCypher query options, including runtime can be defined in GraphQL From version 5+ of the Neo4j GraphQL library, cypher query options are passed per request. Here is an example code snippet of how to set this when using startStandaloneServer: import { ApolloServer } from '@apollo/server'; import { startStandaloneServer } from '@apollo/server/standalone'; import { Neo4jGraphQL } from "@neo4j/graphql"; import neo4j from "neo4j-driver"; const typeDefs = `....`; const driver = neo4j.driver( "neo4j://localhost:7687", neo4j.auth.basic("username", "password") ); const neoSchema = new Neo4jGraphQL({ typeDefs, driver }) const server = new ApolloServer({ schema: await neoSchema.getSchema() }); const { url } = await startStandaloneServer(server, { context: async ({ req }) => ({ req, cypherQueryOptions: { runtime: "slotted", }, }), listen: { port: 4000 }, }); Similarly, here is a brief example of how you could achieve this when using a middleware pattern: import apolloServer from "./server"app.use('/', expressMiddleware(apolloServer, { context: async ({ req, res }) => { return { req, res, cypherQueryOptions: { runtime: 'slotted' }, }; } }, ) ) Prior to version 5 of the Neo4j Cypher library, query options can be set at a global level. Please add CypherRuntime as a constant and then set runtime: CypherRuntime.INTERPRETED, when you define the neoSchema. Below is an example code snippet for this: const { ApolloServer } = require("apollo-server"); const neo4j = require("neo4j-driver"); const fs = require("fs"); const dotenv = require("dotenv"); const path = require("path"); const { Neo4jGraphQL, CypherRuntime } = require("@neo4j/graphql"); // Create executable GraphQL schema from GraphQL type definitions, // using @neo4j/graphql to autogenerate resolvers const neoSchema = new Neo4jGraphQL({ typeDefs, config: { queryOptions: { runtime: CypherRuntime.INTERPRETED, }, }, }); Please note that when you set this, the newly set runtime will be used for all the queries that will run.InformationTitleHow to set the Cypher runtime in GraphQLArticle Created Date3/15/2024, 10:57 PMURL Name4404760202259-How-to-set-the-Cypher-runtime-in-GraphQLLast Modified Date9/4/2025, 5:30 PM