Description
Hi,
I'm not sure how to use parameter values when creating a new Type that has a field of type _Neo4jDate.
I have the following schema:
type Foo
{
uuid: ID!
name: String!
dob: _Neo4jDate
}
I can do:
mutation { createFoo(uuid: $uuid, name: $name, dob: {formatted: \"2020-01-01\" }) { uuid, name, dob { formatted } } }
with parameters:
uuid: 2,
name: "Foo"
I'm not sure what the appropriate syntax is for using a parameter for dob
mutation { createFoo(uuid: $uuid, name: $name, dob: {formatted: $dob }) { uuid, name, dob { formatted } } }
with parameters
uuid: 3,
name: "Bar",
dob: "2020-01-01"
does not "work". As in the translate
method returns cypher, but that cypher does not execute.
The generated cypher is:
CREATE (createFoo:Foo { uuid: $uuid, name: $name, dob: date($createFooDob.formatted) }) WITH createFoo RETURN createFoo { .uuid, .name, dob: { formatted: createFoo.dob } } AS createFoo
the issue appears to be the params. the cypher.params for uuid
and name
are both strings, however the other param is
createFooDob
with a type of Map. The map has a single key formatted
, and value of type VariableReference
.
When trying to execute that cyhper I get an exception:
org.neo4j.driver.exceptions.ClientException: No such field: comments
For the first example, that does work. The cypher query is the same, and the uuuid and name parameters are the same.
The createFooDob
param is of type Map, the map has a single key formatted
, and a value of type string "2020-01-01"
I can run the below query with parameterised dob with no issues
query { foo{ name dob(formatted:$dob) { formatted } } }
with params
"dob": "2020-01-01"
Cheers,
Michael