最佳答案
对于您的多对多关系,我可以建议这种结构吗? :
Exercise_templates
"KBIhcF3L6eTOSSsGzmW"
name: "Squats"
reps: 5
sets: 5
workouts
"KBIYJv6x1YU98eLIwoC": true
Etc …..
"KBIhfwX45S82zyy-8_r"
name: "Squats"
reps: 5
sets: 5
workouts
"KBIdNKOko-ZMY-B04qI": true
workouts
"KBIYJv6x1YU98eLIwoC"
templates
"KBIhcF3L6eTOSSsGzmW" : true
Etc…
"KBIhfwX45S82zyy-8_r"
templates
etc…
要查找锻炼键匹配的所有锻炼模板:
Firebase ref = yourRoot/workouts/KBIYJv6x1YU98eLIwoC/templates
您可以在这里找到文档:( https://www.firebase.com/docs/android/guide/structuring-data.html )
关于javascript - Firebase查找具有特定子ID的所有 parent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35606833/