Using firebase tree structure to represent a “document outline” structure directly

∥☆過路亽.° 提交于 2019-12-20 04:34:51

问题


How good/stupid would it be to use Firebase tree structure to directly represent a user-facing tree structure, like a "document outline" in "word processors"? As opposed to e.g. doing an SQL-join parent-child type of relationship and then building the tree via a projection (which would probably be slow).

I know that there is a limit of 32 levels of nesting ( https://www.firebase.com/docs/web/guide/understanding-data.html ), which should be enough, as I cannot imagine a sane user wanting to do as many levels of nesting for a textual tree-outline... Although maybe I need to divide 32 by two, because of each node needing to have sub nodes for its children and metadata, right?

I know that once a tree node is accessed via Firebase API, then all sub-nodes need to be fetched, which could be a performance problem if the user has a lot of data, but in the end I think this would not be a problem, since the data would mostly be a user-entered plaintext (short).

A performance problem could arise if the user pastes some very long chunks of text copied from somewhere (e.g. tens of kilobytes). But then I could separate those "TLOB-s" via a kind of "symlink" in firebase and fetch them on-demand from a different node, right? Same should apply for separating images and other heavy objects, right? Although in a prototype and early stages, this should probably be ignored, for the sake of simplicity... I could probably put in place a generic approach to "symlinking", to overcome the 32 levels limitation and the need to fetch all sub-nodes at once, right? Is there some best-practices approach for that (e.g. syntax for a firebase node which would symbolise a link to another node) ? I have extracted the "symlinking" idea to a separate question: Firebase "symlink" to another node .

I could probably partition the topmost nodes into some kinds of projects/categories to prevent having to fetch absolutely everything the user has ever had...

Is my reasoning/approach correct?

Is there any consideration that I did not think of, e.g. innate limits on data size or performance or e.g. security rules?

Would I be better served by other technologies like Couchbase/Pouchbase ?

Further details: this is for a hybrid mobile app with some emphasis also on web access and offline access. I hope to do most of the logic in Javascript. The UI part of the question is here: HTML tree for hybrid mobile app .

来源:https://stackoverflow.com/questions/39112792/using-firebase-tree-structure-to-represent-a-document-outline-structure-direct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!