0
我的密碼有什麼問題。完整的描述在標題中。cypher刪除關係數大於數的所有節點關係
match (p:P)<-[r:LINK]-(:G)
with r, count(r) as num
where num > 100
delete r
我的密碼有什麼問題。完整的描述在標題中。cypher刪除關係數大於數的所有節點關係
match (p:P)<-[r:LINK]-(:G)
with r, count(r) as num
where num > 100
delete r
您骨料r
計數r
時,這意味着每一行都會有一個計數的準確1.
爲了解決這個問題,你應該爲聚合p
:
match (p:P)<-[r:LINK]-(:G)
with p, count(r) as num
where num > 100
match (p)<-[r:LINK]-(:G)
delete r
另一個選項是collect
與列表的關係,unwind
對於選定的關係:
match (p:P)<-[r:LINK]-(:G)
with p, count(r) as num, collect(r) as rs
where num > 100
unwind rs as r
delete r
如果使用這種方法,你不妨忽略count(r)
和檢查rs
集合的大小:
match (p:P)<-[r:LINK]-(:G)
with p, collect(r) as rs
where size(rs) > 100
unwind rs as r
delete r
但如果我這樣做的,變量R沒有定義了 – user732456
你對。要解決這個問題,請使用另一個「匹配」 - 我相應地編輯了我的答案。 –
仍然沒有結果。在「匹配(p:P)< - [r:LINK] - (:G)返回p,count(r)作爲num order by num desc limit(25)」後仍然返回結果「仍然返回計數超過1000的結果 – user732456