有没有控制属性顺序的机制?
我无法在http://www.neo4j.org/console上重现这个问题。
如果我使用Neo4j 1.9.2 Community,执行以下操作:
CREATE (m1 {`$type`: {moduleTypeName}, Name: 'M1', ModelNumber: 'MN1'})
稍后,当我从REST Cypher端点使用Cypher查询获取此节点时,我会收到以下内容...
{
"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"
}
}
我正在使用http://james.newtonking.com/pages/json-net.aspx来解析JSON,为了让它自动推断对象类型,$type属性必须排在首位。当您在流中解析JSON时,这是有意义的,因为您不想先将整个JSON加载到内存中。
似乎它并不按字母顺序排列,也不似乎是随机的。对于不同的对象类型,它的顺序是一致的,但在它们之间则不一致。
我还在Shell中提取了节点,因此似乎顺序不取决于我获取节点的方式,但也与我创建节点的顺序无关。