什么类型的NoSQL数据库最适合存储分层数据?[英] What type of NoSQL database is best suited to store hierarchical data?

本文是小编为大家收集整理的关于什么类型的NoSQL数据库最适合存储分层数据?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

哪种类型的NOSQL数据库最适合存储层次数据?

说例如,我想用树结构存储论坛的帖子:

original post
 + re: original post
 + re: original post
   + re2: original post
     + re3: original post
   + re2: original post

推荐答案

MongoDB和CouchDB提供解决方案,但不提供功能.在代表层次结构中,请参见此问题.关系数据库正如我所看到的大多数其他NOSQL解决方案一样,在这方面相似.您必须编写自己的算法来重新计算该信息作为节点的添加,删除和移动.一般而言,您在快速阅读时间之间做出决定(例如 nested nested set )或快速写入时间(邻接列表).有关沿着这些行的更多选项,请参见上述问题:平桌方法似乎与您的问题最为一致.

抽象这些考虑因素的一个标准是 apache jackrabbit JBOSS EXO 是实现.注意,幕后仍在进行某种算法计算以维护层次结构,如上所述.此外,JCR还处理权限,文件存储和其他几个方面 - 因此,这可能对您的项目过大.

其他推荐答案

您可能需要的是面向文档的数据库,例如 mongodb couchdb .

请参阅不同技术的示例,这些示例允许您将层次数据存储在MongoDB中: /p>

其他推荐答案

最常见的是也是 cache数据库

参见这个问题发布在Stackexchange的DBA部分上>

本文地址:https://www.itbaoku.cn/post/597419.html

问题描述

What type of NoSQL database is best suited to store hierarchical data?

Say for example I want to store posts of a forum with a tree structure:

original post
 + re: original post
 + re: original post
   + re2: original post
     + re3: original post
   + re2: original post

推荐答案

MongoDB and CouchDB offer solutions, but not built in functionality. See this SO question on representing hierarchy in a relational database as most other NoSQL solutions I've seen are similar in this regard; where you have to write your own algorithms for recalculating that information as nodes are added, deleted and moved. Generally speaking you're making a decision between fast read times (e.g. nested set) or fast write times (adjacency list). See aforementioned SO question for more options along these lines - the flat table approach appears most aligned with your question.

One standard that does abstract away these considerations is the Java Content Repository (JCR), both Apache JackRabbit and JBoss eXo are implementations. Note, behind the scenes both are still doing some sort of algorithmic calculations to maintain hierarchy as described above. In addition, the JCR also handles permissions, file storage, and several other aspects - so it may be overkill for your project.

其他推荐答案

What you possibly need is a document-oriented database like MongoDB or CouchDB.

See examples of different techniques which allow you to store hierarchical data in MongoDB: http://www.mongodb.org/display/DOCS/Trees+in+MongoDB

其他推荐答案

The most common one is IBM's IMS.There is also Cache Database

See this question posted on dba section of stackexchange.