Can Neo4j property order be controlled? -


is there mechanism controlling order of properties?

i cannot reproduce in http://www.neo4j.org/console

using neo4j 1.9.2 community if following:

create (m1 {`$type`: {moduletypename}, name: 'm1', modelnumber: 'mn1'}) 

then later node cypher query using rest cypher endpoint back...

{     "extensions": {},     "paged_traverse": "http://localhost:7575/db/data/node/3777/paged/traverse/{returntype}{?pagesize,leasetime}",     "outgoing_relationships": "http://localhost:7575/db/data/node/3777/relationships/out",     "traverse": "http://localhost:7575/db/data/node/3777/traverse/{returntype}",     "all_typed_relationships": "http://localhost:7575/db/data/node/3777/relationships/all/{-list|&|types}",     "property": "http://localhost:7575/db/data/node/3777/properties/{key}",     "all_relationships": "http://localhost:7575/db/data/node/3777/relationships/all",     "self": "http://localhost:7575/db/data/node/3777",     "properties": "http://localhost:7575/db/data/node/3777/properties",     "outgoing_typed_relationships": "http://localhost:7575/db/data/node/3777/relationships/out/{-list|&|types}",     "incoming_relationships": "http://localhost:7575/db/data/node/3777/relationships/in",     "incoming_typed_relationships": "http://localhost:7575/db/data/node/3777/relationships/in/{-list|&|types}",     "create_relationship": "http://localhost:7575/db/data/node/3777/relationships",     "data": {         "modelnumber": "mn1",         "$type": "moduletype",         "name": "m1"     } } 

i'm using http://james.newtonking.com/pages/json-net.aspx parse json , automatically infer object type, $type property must first. makes sense when parsing json in stream when don't want load entire thing memory first.

it not appear alphabetical, , not seem random either. seems order consistent different object types, inconsistent between them.

i have pulled node in shell , seems order not depend on how node, not related order in create node either.

properties have no guaranteed order. not take assumptions on 'maybe' ordering. upcoming version might change assumed behaviour , break code.

i guess simpler in cypher not return node in favour of list of properties, e.g.

start node=node(<myid>) return node.`$type`, node.modelnumber, node.name 

this has defined columns.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -