【发布时间】:2017-01-21 05:52:22
【问题描述】:
我正在尝试为学生创建基本数据结构 -> 教师关系。
- 学生 -> 老师(多对多)
每个学生可以有很多老师
Users
uid1:
type: student
name: Alex Smith
teachers: [uid5: true, uid4: true ] //is it better to do it like this?
uid2:
type: student
name: Michael A
teachers: [ uid5: true]
uid3:
type: student
name: Michael A
teachers: [uid5: true]
uid4:
type: teacher
name: Alex Smith
teacher: [uid3: true] //is it better to use their uid?
uid5:
type: teacher
name: Teacher 1
students: [uid1: true, uid2: true]
或者可以像这样改变结构
Users:
Teachers:
Relation:
这对 Firebase 来说是不是很好的数据结构?我应该像这样分离关系节点吗?如果您有更好的主意,请给我您的数据结构!
【问题讨论】:
标签: firebase firebase-realtime-database nosql