firebase结构学院db [英] firebase structure college db

查看:175
本文介绍了firebase结构学院db的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计了我的firebase结构,我不确定这是否正确。

小信息:

每个学院都有一些部门。

每个部门都有很多课程。课程可以分属几个部门。
每门课程都有一些课程。课程可以属于一门课程。

我拥有所有关键课程和信息的课程节点


我有各个部门和各个部门的信息节点。
我有节点Course_Departments和Departments_courses

$ b

$ b显示每个课程由一些讲师学习,每个讲师讲授一些课程。

所以我的问题是:
1.如何将课程连接到这些表例如?我想找到lecture_key2教授的course_key1的所有课程?
2.以这种方式使用多个表可能需要很多时间来获取数据?
for UI我不希望用户等待太多的数据。

我想,你是在正确的轨道上。



我会给你提供一些你可以照顾的提示。在设计Firebase数据库的结构时,应该牢记非关系数据库的规则。

其中之一就是反规范化。保持层次平坦!由于涉及到所有子节点,这对于数据更改侦听器来说是一个重要的性能因素。这就是你到目前为止所做的。



通过使用键可以实现实体之间的关系。正如您在 Courses_Department 节点中所做的那样。应该使用内置的密钥创建。他们应该是普遍独特的。



这是一个很好的来自关系数据库的解释。


I design my firebase structure and I'm not sure if that the right way.

Little information:

Each college has some departments.

Each departments has many courses.Courses can belong to several departments. Each Course has some lessons. lesson can be belong to one course.

I have node of courses with all key courses and information

I have node of departments with all departments and informations. I have node Course_Departments and Departments_courses

in addition I have courses_lectures and courses_lectures for display each course learn by some lecturers and each lecturers teach some courses.

so my questions are: 1.How I connect the lesson to these table for example? I want to find all the lessons of the course_key1 that lecture_key2 teach? 2. using with many tables in this way can be take many time to get the data? for UI I don't want to users to wait much for the data.

解决方案

Looking at your design, I think, you are on the right track.

I'll give some possible hints of what you can take care of. When designing the structure of a Firebase database design rules of non-relational databases should be kept in mind.

One of them is denormalization. Keep the hierarchy flat! That's an important performance factor for data change listeners since all subnodes are involved. That's what you've done so far.

Relationship of entities can be achied by using the keys. Exactly as you did it in the Courses_Department node. The built-in creation of keys should be used. They should be universally unique.

Here's a good explanation when coming from relational databases.

这篇关于firebase结构学院db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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