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

Create doesn't work with lists #130

Open
Yorkst opened this issue Oct 7, 2016 · 4 comments
Open

Create doesn't work with lists #130

Yorkst opened this issue Oct 7, 2016 · 4 comments

Comments

@Yorkst
Copy link

Yorkst commented Oct 7, 2016

db.nodes.create(parameter=[]) fails with "Bad Request. Bad request syntax or unsupported method."

@versae
Copy link
Owner

versae commented Oct 10, 2016

That's because the REST API doesn't support storing objects as properties values other than plain numbers, booleans, and strings. Plus, Neo4j doesn't store either null or empty property values.

@Yorkst
Copy link
Author

Yorkst commented Oct 10, 2016

My neo4j sure does

create (t:Test {data: []})

match(t:Test) return t.data

Neo4j

@versae
Copy link
Owner

versae commented Oct 10, 2016

Does that work through the REST API using the API methods and not Cypher queries? I'll double check.

@versae
Copy link
Owner

versae commented Oct 10, 2016

Just tried with 2.2.10 and 2.3.7 and got this:

$ curl -H "Content-Type: application/json" -X POST http://localhost:7474/db/data/node -d '{"prop": []}'
{
  "message" : "Unable to set property 'prop' to an empty array, because, since there are no values of any type in it, and no pre-existing collection to infer type from, it is not possible to determine what type of array to store.",
  "exception" : "PropertyValueException",
  "fullname" : "org.neo4j.server.rest.web.PropertyValueException",
  "stackTrace" : [ "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperty(PropertySettingStrategy.java:120)", "org.neo4j.server.rest.domain.PropertySettingStrategy.setProperties(PropertySettingStrategy.java:88)", "org.neo4j.server.rest.web.DatabaseActions.createNode(DatabaseActions.java:205)", "org.neo4j.server.rest.web.RestfulGraphDatabase.createNode(RestfulGraphDatabase.java:252)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)", "java.lang.Thread.run(Thread.java:745)" ],
  "errors" : [ {
    "message" : "Unable to set property 'prop' to an empty array, because, since there are no values of any type in it, and no pre-existing collection to infer type from, it is not possible to determine what type of array to store.",
    "code" : "Neo.ClientError.Statement.InvalidArguments"
  } ]
}

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

No branches or pull requests

2 participants