本文介绍了使用MongoDB作为主数据库,我应该使用单独的图表数据库来实现实体之间的关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在为专业公司内部实施类似CRM的解决方案。由于存储的信息的性质,以及我们决定使用文档存储数据库的信息的变化值和键,因为它完全符合目的(在这种情况下,我们选择了MongoDB)。

We're currently in the process of implementing a CRM-like solution internally for a professional firm. Due to the nature of the information stored, and the varying values and keys for the information we decided to use a document storage database, as it suited the purposes perfectly (In this case we chose MongoDB).

作为这个CRM解决方案的一部分,我们希望存储实体之间的关系和关联,例子包括存储利益冲突信息,股东,受托人等。以最有效的方式将所有这些实体联系在一起,我们确定了一个中心关系模式是必要的。所有关系应具有附加的历史信息(开始和终止日期)以及不同的元数据;例如,股东关系也将包含持有的股份数量。

As part of this CRM solution we wish to store relationships and associations between entities, examples include storing conflicts of interest information, shareholders, trustees etc. Linking all these entities together in the most effective way we determined a central model of "relationship" was necessary. All relationships should have history information attached to them ( commencement and termination dates), as well as varying meta data; for example a shareholder relationship would also contain number of shares held.

由于传统的RDBMS解决方案不符合我们以前的需求,因此在目前的情况下使用它们是不可行的。我想要确定的是,使用图形数据库是否更适合我们的情况,或者实际上只是使用mongo的内置关系信息是适当的。

As traditional RDBMS solutions didn't suit our former needs, using them in our current situation is not viable. What I'm trying to determine is whether using a graph database is more pertinent in our case, or if in fact just using mongo's built-in relational information is appropriate.

在整个系统中,关系信息将被相当大的使用。我们希望执行的一些信息查询的一个例子是:

The relationship information is going to be used quite heavily throughout the system. An example of some of the informational queries we wish to perform are:


  • 获取所有客户公司的所有重要联系人的'xyz有限制'

  • 获取'john'为股东的公司所有其他'股东'

  • 获取所有主要联系人 abc limited客户的实体是信任我们银行限制的客户。

给定这个树结构的关系,正在使用图形数据库(如Neo4j)更合适?

Given this "tree" structure of relationships, is using a graph database (such as Neo4j) more appropriate?

推荐答案

Mike,

您应该能够将关系数据存储在图形数据库中。它在遍历大图上的高性能来自于本地化,即您不在全局运行查询,而是启动一组节点(在您的情况下等同于您的情况下的文档,它们由索引查找),甚至可以存储起始节点 - ids可以在您的mongo文档中快速访问)。从那里你可以随时遍历任意大的路径(wrt数据集大小)。

you should be able to store your relationship data in the graph database. Its high performance on traversing big graphs comes from locality, i.e. you don't run queries globally but rather start a a set of nodes (which equal documents in your case, which are looked up by an index. you might even store start-node-ids for quick access in your mongo documents). From there you can traverse arbitrarily large paths in constant time (wrt data set size).

您的其他要求(即数据集大小,并发访问数等)关系/图形复杂性)。

What are your other requirements (i.e. data set size, # of concurrent accesses etc, relationship/graph complexity).

您的查询非常适合图形数据库,并且可以在其条款中轻松表达。

Your queries are a really good fit for the graph database and easily expressable in its terms.

我建议您只需要像neo4j一样获取一个graphdb,并与您的域名进行快速的匹配,以验证一般的可行性,并且还会发现您想要的其他问题在投资第二项技术之前已经回答。

I'd suggest that you just grab a graphdb like neo4j and do a quick spike with your domain to verify the general feasibility and also find out additional questions you would like to have answered before investing in the second technology.

PS如果还没有启动,您也可以使用纯粹的graphdb方法,因为图形数据库是文档数据库的超集。而您宁愿在您的案例中谈论域名,而不仅仅是通用文档。 (例如是建立在Neo4j上的CMS)。

P.S. If you hadn't started yet, you could also have gone with a pure graphdb approach as graph databases are a superset of document databases. And you'd rather talk domain in your case anyway than just generic documents. (E.g. structr is a CMS built on top of Neo4j).

这篇关于使用MongoDB作为主数据库,我应该使用单独的图表数据库来实现实体之间的关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 03:24