Error while executing Neo4j query include point type


(403445064) #1

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"]
}]
}
"

(Stefan Armbruster) #2

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.


(403445064) #3

Unfortunately, bolt - which does not support point property


(Stefan Armbruster) #4

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