Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating Types with Temporal (date) types via parameters #108

Closed
michael-forman opened this issue Aug 12, 2020 · 0 comments · Fixed by #235
Closed

creating Types with Temporal (date) types via parameters #108

michael-forman opened this issue Aug 12, 2020 · 0 comments · Fixed by #235

Comments

@michael-forman
Copy link
Contributor

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

Andy2003 added a commit that referenced this issue Jun 11, 2021
With these changes a new configuration param `useTemporalScalars` was introduced. With this configuration enabled, neo4js' temporales like `Date`, `Time`, `LocalTime`, `DateTime` and `LocalDateTime` are used as scalars (strings).

resolves #223, #109, #108, #93
Andy2003 added a commit that referenced this issue Jun 12, 2021
With these changes a new configuration param `useTemporalScalars` was introduced. With this configuration enabled, neo4js' temporales like `Date`, `Time`, `LocalTime`, `DateTime` and `LocalDateTime` are used as scalars (strings).

resolves #223
resolves #109
resolves #108
resolves #93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant