Firebase Flutter:如何查询实时数据库中的嵌套数据列表

huangapple go评论57阅读模式
英文:

Firebase Flutter: how to quay Real time database nested data list

问题

I am trying to display all this shop's inventory data and filter by category/name/price/etc..

  1. 我可以通过使用 orderbyChild("Shop") 将所有数据推送到列表中并显示/过滤数据,但是对于大量用户数据,这种方式可能会导致性能问题?
  2. 有没有更好的方法来获取所有这些商店的数据并使用类别/产品名称/价格等进行筛选?

Firebase Flutter:如何查询实时数据库中的嵌套数据列表

英文:

i am trying to display all this shops inventory data and filter by category/name/price/etc..

  1. i can do this by using orderbyChild("Shop") and push all data in
    to list and display/filter data but with large user data that
    way can cause performance?
  2. is their better way to get all this shops data and filter using
    category /product name/price/etc...

Firebase Flutter:如何查询实时数据库中的嵌套数据列表

答案1

得分: 0

Firebase Realtime Database查询会在查询路径下的每个直接子节点下查找值。它们不会在所有子节点中递归搜索。因此,如果您想要跨所有商店进行搜索,您可能还需要将数据存储在一个扁平列表中。

另请参阅 https://stackoverflow.com/questions/27207059/firebase-query-double-nested

英文:

Firebase Realtime Database queries look for values at a fixed path under each direct child node of the path that you query. They don't recursively search on all nodes under there. So, if you want to search across all shops, you'll have to (possibly additionally) store the data in a flat list.

Also see https://stackoverflow.com/questions/27207059/firebase-query-double-nested

huangapple
  • 本文由 发表于 2023年1月6日 10:24:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75026337.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定