Firebase并选择不同的 [英] Firebase and select distinct
本文介绍了Firebase并选择不同的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用firebase的REST API在流派节点上做出不同的选择吗?
当您阅读Firebase中的一棵树时,你得到所有的孩子。这是没有办法的。然而,你可以创建一个数据结构,只保存每部电影的流派。
< $ p
$ movie $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b3647:{
0:戏剧
},
3648:{
0:恐怖,
1 :科幻
}
}
}
现在获得流派是一个简单的阅读。
My data in firebase looks like
Can I do a select distinct on the Genre node using the REST API of firebase?
解决方案
When you read a tree in Firebase, you get all the children. There's no way around this.
You can however, create a data structure that holds just the genres per movie.
{
"movieGenres": {
"3646": {
"0": "Comedy"
},
"3647": {
"0": "Drama"
},
"3648": {
"0": "Horror",
"1": "Sci-Fi"
}
}
}
Now getting the genres is a simple read.
这篇关于Firebase并选择不同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文