Get Firebase child nodes' names without getting their children too in Firebase response?

前端 未结 2 830
闹比i
闹比i 2020-12-16 15:24

I have the following hierarchy on firebase, some data are hidden for confidentiality:

\"enter

相关标签:
2条回答
  • 2020-12-16 15:40

    It is a bit old, and you probably already know, but in case someone else comes along. You can do this using REST api call, you only need to set the parameter shallow=true

    here is the documentation

    0 讨论(0)
  • 2020-12-16 15:50

    UPDATE: There is now a shallow command in the REST API that will fetch just the keys for a path. This has not been added to the SDKs yet.

    In Firebase, you can't obtain a list of node names without retrieving the data underneath. Not yet anyways. The performance problems can be addressed with normalization.

    Essentially, your goal is to split data into consumable chunks. Store your list of video keys, possible with a couple meta fields like title, etc, in one path, and store the bulk content somewhere else. For example:

    /video_meta/id/link, title, ...
    /video_lines/id/...
    

    To learn more about denormalizing, check out this article: https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html

    0 讨论(0)
提交回复
热议问题