Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-24-2021 10:51 AM
anyway to pass dynamic complete cypher query as input variable in graphql
like below .my cypher query changes dynamically so looking for some dynamic approach while defining graphql schema.
type Customer {
basic_count(input: String): String
@cypher(
statement: """
$input
"""
)
}
08-24-2021 01:59 PM
Yes, any field arguments defined in a Cypher directive GraphQL field are passed as Cypher parameters to the Cypher query defined in the directive. For example:
type Query {
movieSearch(searchTerm: String!): [Movie] @cypher(statement: """
MATCH (m:Movie) WHERE m.title CONTAINS $searchTerm
RETURN m
"""
}
There's a bit more info in the docs here: @cypher directive - Neo4j GraphQL Library
As an aside, if you are looking to calculate the total number of nodes matching some filter you may benefit from the auto-generated count queries: Queries - Neo4j GraphQL Library
08-24-2021 02:31 PM
Thanks for response!
I was able to run such schema where i can pass $searchTerm as a input parameter
but i want to pass Whole cypher statement as a input parameter , because in many scenarios i am not aware about node and properties values in advance.
Thanks
01-26-2023 01:55 PM
Any way to provide n:$input.label ?
All the sessions of the conference are now available online