有以下数据:
create (_66:`User` {`ban`:4, `banned`:1, `chitaet`:942, `chitateli`:444, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:118});
create (_67:`User` {`ban`:0, `banned`:0, `chitaet`:26, `chitateli`:59, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:119});
create _66<-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]-_67;
create _66-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]->_67;
为什么以下查询没有返回结果?
MATCH (a:`User`)-[:FOLLOW {lenta:'main'}]->(b:`User`) WHERE a.`id` = 118 RETURN b.id AS id LIMIT 10;
答案 0 :(得分:1)
我相信查询是按顺序执行的,因此当Neo4j到达时:
create _66<-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]-_67;
它不知道_66
或_67
是什么。
尝试:
create (_66:`User` {`ban`:4, `banned`:1, `chitaet`:942, `chitateli`:444, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:118})
,(_67:`User` {`ban`:0, `banned`:0, `chitaet`:26, `chitateli`:59, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:119})
, _66<-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]-_67
, _66-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]->_67;
类似的东西总是适用于我的数据库。
我建议你也返回一些值。这样您就可以验证create语句是否已成功执行
create (_66:`User` {`ban`:4, `banned`:1, `chitaet`:942, `chitateli`:444, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:118}),
(_67:`User` {`ban`:0, `banned`:0, `chitaet`:26, `chitateli`:59, `disable_r`:0, `disabled_r`:0, `hide`:0, `id`:119}),
_66<-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]-_67,
_66-[:`FOLLOW` {`id`:54820, `lenta`:"main", `time`:1436720633}]->_67,
return _66,_67;
答案 1 :(得分:0)
您User
标签中的错字 - 您要查询Users
。
尝试
MATCH (a:`User`)-[:FOLLOW {lenta:'main'}]->(b:`User`) WHERE a.`id` = 118 RETURN b.id AS id LIMIT 10;