Open Yorkst opened 8 years ago
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.
My neo4j sure does
create (t:Test {data: []})
match(t:Test) return t.data
Does that work through the REST API using the API methods and not Cypher queries? I'll double check.
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"
} ]
}
db.nodes.create(parameter=[]) fails with "Bad Request. Bad request syntax or unsupported method."