cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Error while executing Neo4j query include point type

neo4j version 3.4.0

The gps node contains three attributes:

coordinates: point

location: string

type: string

eg: coordinates: point({srid:4326, x:30.655691, y:104.081602}) ,location: shanghai ,type: gps

I encountered an error while querying:

curl http://IP:PORT/db/data/transaction/commit -u xxxx:xxxx -H "Content-Type: application/json"
-d "{
"statements": [{
"statement": "match (n:gps) return n",
"parameters": {},
"includeStats": true,
"resultDataContents": ["rest"]
}]
}
"

Error is as follows: "code": "Neo.TransientError.Network.CommunicationError", "message": "Current context not an ARRAY but OBJECT", "stackTrace": "org.codehaus.jackson.JsonGenerationException: Current context not an ARRAY but OBJECT

But the following procedure was successful

curl http://IP:PORT/db/data/transaction/commit -u xxxx:xxxx -H "Content-Type: application/json"
-d "{
"statements": [{
"statement": "match (n:gps) return n.coordinates,n.type,n.loacation",
"parameters": {},
"includeStats": true,
"resultDataContents": ["rest"]
}]
}
"
3 REPLIES 3

It looks like demarshalling a coordinate doesn't work on the http endpoint. You can either switch to use bolt - which is anyway recommended over http. The other workaround would be not to return the geo property and instead return explicitly there x,y and z coordinates directly as numbers.

Unfortunately, bolt - which does not support point property

Not 100% sure, but I guess the latest versions of the bolt drivers should treat locations as first class citizens.