jameslouiz jameslouiz - 8 months ago 63
Javascript Question

Nodes have additional keys when using neo4j-javascript driver

I'm slowly migrating my backend over to use the new javascript drivers for neo4j 3.0.3 over the bolt protocol but objects returned contain 3 properties:

identity: {},
keys: [],
properties: {
foo: 'bar',
fooo: 'baar'

I was using a simple rest client before and it would just return the properties, which is what I wanted. How do I get it do that using the javascript drivers and omit this nested structure?

Answer Source

I've since discovered that NEO4J has a properties() method which extracts all the properties from the node.

MATCH (n:User)
WHERE n.name = 'bob'
RETURN properties(n)