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

查看:28
本文介绍了哪种类型的 NoSQL 数据库最适合存储分层数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种类型的 NoSQL 数据库最适合存储分层数据?

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 和 CouchDB 提供解决方案,但没有内置功能.请参阅关于 表示层次结构的这个 SO 问题一个关系数据库,因为我见过的大多数其他 NoSQL 解决方案在这方面都是相似的;您必须编写自己的算法,以便在添加、删除和移动节点时重新计算该信息.一般来说,您在快速读取时间(例如 嵌套集)或快速写入时间之间做出决定(邻接列表).有关这些方面的更多选项,请参阅上述 SO 问题 - flat table approach 似乎最符合您的问题.

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.

抽象出这些考虑因素的一个标准是 Java 内容存储库 (JCR),两者都是Apache JackRabbitJBoss eXo 是实现.请注意,在幕后,两者仍在进行某种算法计算以保持如上所述的层次结构.此外,JCR 还处理权限、文件存储和其他几个方面 - 所以它可能对您的项目来说是多余的.

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.

这篇关于哪种类型的 NoSQL 数据库最适合存储分层数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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