删除用户的Neo4j中的所有关系和连接的节点 [英] Delete all relations and connected nodes in Neo4j for a user

查看:154
本文介绍了删除用户的Neo4j中的所有关系和连接的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们选择neo4j作为Web应用程序的数据库.用户具有大量的关系和连接的节点.到目前为止,一个用户大约有20种关系.功能之一是新闻源功能.如果我想完全删除用户,密码查询是删除的最佳方法还是有其他替代方法?

We have selected neo4j as the DB for our web application. The user has a large number of relations and connected nodes. As of now there are about 20 relations for a user. One of the features is a newsfeed feature. If i want to delete a user completely, is the cypher query the best way to delete or is there any other alternative?

由于我们仍在计划添加新功能,因此连接到用户的关系和节点也会增加.因此,如果我们使用密码查询,则必须为添加的每个新关系修改查询.请告知.

Since we are still planning to add new features, the relationships and nodes connected to the user also will increase. So if we use cypher query, the query has to be modified for every new relationship added. Please advise.

谢谢, 帕万(Pavan)

Thanks, Pavan

推荐答案

是的,您可以使用Cypher删除用户.当然,还有其他方法,具体取决于您与Web应用程序一起使用的语言或框架.如果您想就此提出建议,请详细说明如何使用Neo4j.

Yes, you can use Cypher to remove a user. Of course, there are alternative methods, depending on the language or framework you're using with your web application. If you like to have advise on that, please specifiy how you're using Neo4j in detail.

请注意,必须先删除所有关系(传出和传入),才能删除节点.

Note that you have to remove all relationships (outgoing and incoming) first in order to be able to remove the node.

示例:

START n = node(3)
MATCH n-[r]-()
DELETE n, r

此示例摘自官方手册: http://docs.neo4j.org/chunked/milestone/query-delete.html

This example was taken from the official manual: http://docs.neo4j.org/chunked/milestone/query-delete.html

这篇关于删除用户的Neo4j中的所有关系和连接的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆