neo4j 的这个创建语句语法有什么问题?



我是neo4j的新手,我被困在一个简单的问题上:

create (machine1:host);
match (n) where n.host='machine1' return n;

匹配失败。使用解释时,我看到这个:

The provided property key is not in the database
One of the property names in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing property name is: host)

我做错了什么?谢谢大家的时间。

您应该知道标签和属性之间的区别。 标签是节点的分组工具,其中具有标签的所有节点都属于同一组。 我认为您应该为代表机器的节点使用机器标签。 并且您应该使用主机属性来存储其名称值。

create (:Machine {host:'machine1'});
match (n) where n.host='machine1' return n;

甚至更好:

match (n:Machine) where n.host='machine1' return n;

最新更新