【发布时间】:2016-06-26 03:27:30
【问题描述】:
对于我的 Firebase 数据结构,我希望它能够处理这样的事情:
用户可以创建一种记录想法的方式。他们可以随心所欲地称呼它。 Mary Chen 传递参数journal 而Mr Owner 想要命名它(传递参数)log。 Firebase 将它们保存为他们自己的树命名它用户要求命名它的任何参数。
然后出现另一棵树:whenLoggedIn + \(parameter)。这棵树将yyyy-mm-dd 日期保存到相应的帖子中。
例子:
{
"uids": {
"D0Ez8edYhIbTuUfmIeO0KOq5xVB3": {
"friends": {
"IbTuUfmIeO0KOBr5Q4gAqD": true
},
"name": "Mary Chen",
"journal": {
"entry 1- trader joes": "went to store! :)",
"entry 2- ate sushi": "took out the garbage today then got free sushi from trader joes!!!"
},
"whenLoggedInJournal": {
"1": "1997-12-25",
"2": "2016-2-23"
}
},
"L8kBHaGBr5Q4gAqDOhFY29Okepm1": {
"friends": {
"D0Ez8edYhIbTuUfmIeO0KOq5xVB3": true
},
"name": "Mr Owner",
"journal": {
"log 1": "spotted some drunkard in my store",
"log 2": "drainage pipe clogged with tomatos, I suspect the drunkard",
"log 3": "did inventory check, 1 less sushi box, suspect the drunkard"
},
"whenLoggedInLog": {
"1": "1997-12-25",
"2": "2016-2-27",
"3": "2016-4-2"
}
}
}
}
我通读了 Firebase 指南上的“结构化数据”,但我没有掌握如何一次添加树。我也想实现一个扁平化的数据集;这对我正在做的事情有必要吗?
【问题讨论】:
标签: ios swift firebase firebase-authentication nosql