firebase retrieve data by using orderByKey() and equalTo()

前端 未结 2 1930
长发绾君心
长发绾君心 2021-02-03 13:03

So I\'m trying to find the data \"aaaaabbbbbbaaaa\" in this structure:

disney
 studentList
 -Jh46tlaNFx_YmgA8iMJ: \"aaaaabbbbbbaaaa\"
 -Jh474kAvoekE4hC7W3b:\"54c         


        
2条回答
  •  心在旅途
    2021-02-03 13:48

    I guess it was added after your question was made, the solution here https://firebase.google.com/docs/database/admin/retrieve-data?hl=en#ordering-by-value tackles your need right away:

    ref("studentList").orderByValue().on("value", function(snapshot) {
      snapshot.forEach(function(data) {
        console.log(data.val());
      });
    });
    

提交回复
热议问题