graphaware / node-neo4j-bolt-adapter

An adapter for the official neo4j-javascript-driver, allowing it to be used as a drop-in replacement for the node-neo4j community driver.
5 stars 0 forks source link

TypeError: Cannot read property '_fields' of undefined #1

Open cormander opened 5 years ago

cormander commented 5 years ago

Hi,

Love this package! I'm receiving the below error when attempting to return the point() property that was introduced in neo4j 3.4.

TypeError: Cannot read property '_fields' of undefined
    at isRecord (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:80:20)
    at toNative (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:66:9)
    at /app/node_modules/node-neo4j-bolt-adapter/Mapper.js:89:20
    at Array.forEach (<anonymous>)
Returning http 500 error with msg: Internal server error.
    at mapObj (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:88:22)
    at toNative (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:67:41)
    at /app/node_modules/node-neo4j-bolt-adapter/Mapper.js:89:20
    at Array.forEach (<anonymous>)
    at mapObj (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:88:22)
    at toNative (/app/node_modules/node-neo4j-bolt-adapter/Mapper.js:67:41)

The json object when using the browser looks like this:

"position":point({srid:4326, x:-121.483536, y:38.5497})

A workaround is to project the node as a map and return the point as additional properties:

match (a:Address) with a, a.position as ap return a{longitude:ap.x,latitude:ap.y,.street,.city,.state,.zip,.created,.updated};

But it would be nice to have support for this property type in this adapter.

Thanks!

ikwattro commented 5 years ago

Ping @jasperblues . Do you want to transfer this repo to your ownership @jasperblues ?

cormander commented 5 years ago

The Point object in the neo4j javascript driver is already an object, so we can just return it as see. Tested the pull request and it solves this issue for me. Let me know if you have any questions.

jasperblues commented 4 years ago

Ping @jasperblues . Do you want to transfer this repo to your ownership @jasperblues ?

(bump) Yes please. Happy to support remaining users and/or help them migrate to driving.org