• <legend id='VxWxl'><style id='VxWxl'><dir id='VxWxl'><q id='VxWxl'></q></dir></style></legend>

  • <small id='VxWxl'></small><noframes id='VxWxl'>

    <tfoot id='VxWxl'></tfoot>
          <bdo id='VxWxl'></bdo><ul id='VxWxl'></ul>
        <i id='VxWxl'><tr id='VxWxl'><dt id='VxWxl'><q id='VxWxl'><span id='VxWxl'><b id='VxWxl'><form id='VxWxl'><ins id='VxWxl'></ins><ul id='VxWxl'></ul><sub id='VxWxl'></sub></form><legend id='VxWxl'></legend><bdo id='VxWxl'><pre id='VxWxl'><center id='VxWxl'></center></pre></bdo></b><th id='VxWxl'></th></span></q></dt></tr></i><div id='VxWxl'><tfoot id='VxWxl'></tfoot><dl id='VxWxl'><fieldset id='VxWxl'></fieldset></dl></div>

        根据 Firebase 中的子子项过滤产品

        时间:2023-09-08

        • <bdo id='OyNcR'></bdo><ul id='OyNcR'></ul>
              <legend id='OyNcR'><style id='OyNcR'><dir id='OyNcR'><q id='OyNcR'></q></dir></style></legend>

              1. <small id='OyNcR'></small><noframes id='OyNcR'>

                  <tbody id='OyNcR'></tbody>
              2. <i id='OyNcR'><tr id='OyNcR'><dt id='OyNcR'><q id='OyNcR'><span id='OyNcR'><b id='OyNcR'><form id='OyNcR'><ins id='OyNcR'></ins><ul id='OyNcR'></ul><sub id='OyNcR'></sub></form><legend id='OyNcR'></legend><bdo id='OyNcR'><pre id='OyNcR'><center id='OyNcR'></center></pre></bdo></b><th id='OyNcR'></th></span></q></dt></tr></i><div id='OyNcR'><tfoot id='OyNcR'></tfoot><dl id='OyNcR'><fieldset id='OyNcR'></fieldset></dl></div>

                  <tfoot id='OyNcR'></tfoot>
                • 本文介绍了根据 Firebase 中的子子项过滤产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我试图弄清楚如何根据 Firebase 中的子子节点过滤产品.

                  I am trying to figure out how to filter products based on their sub child nodes in Firebase.

                  我的设置如下:

                  products/
                       product1
                          /author: 12345
                          /title: "Awesome"
                          /description: "more awesome"
                       product2
                          /author: 67890
                          /title: "Awesome"
                          /description: "more awesome"
                  

                  如何查询 Firebase 以便仅检索它所持有的 child($productId).child(author) 等于 12345 的产品?

                  How can I query Firebase such that I retrieve only the products for which it holds that child($productId).child(author) equals 12345?

                  我尝试了以下方法,但这显然不起作用.我需要一种过滤子子项的方法:

                  I tried the following, but that obviously does not work. I need a way to filter on the subchild:

                  var ref = new Firebase(FBURL);
                  
                  // Attach an asynchronous callback to read the data at our posts reference
                  ref.child("products").child('$productId').child('author').equalTo(12345).on("value", function(snapshot) {
                        console.log(snapshot.val());
                      }, function (errorObject) {
                        console.log("The read failed: " + errorObject.code);
                  });
                  

                  推荐答案

                  只需使用orderByChild():

                  ref.child("products").orderByChild('author').equalTo(12345)...
                  

                  这将通过 author 属性对 products 下的每个子节点进行排序,然后仅返回值为 12345 的子节点.

                  This will order every child node under products by its author property and then return only the ones that have a value of 12345.

                  请参阅 Firebase 关于查询的文档.

                  这篇关于根据 Firebase 中的子子项过滤产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Firebase 中过滤多个子属性的产品 下一篇:NoSQL 数据结构,用于使用 Firebase 和查询选择字段

                  相关文章

                  最新文章

                  1. <legend id='3Z6UK'><style id='3Z6UK'><dir id='3Z6UK'><q id='3Z6UK'></q></dir></style></legend>
                  2. <small id='3Z6UK'></small><noframes id='3Z6UK'>

                    <i id='3Z6UK'><tr id='3Z6UK'><dt id='3Z6UK'><q id='3Z6UK'><span id='3Z6UK'><b id='3Z6UK'><form id='3Z6UK'><ins id='3Z6UK'></ins><ul id='3Z6UK'></ul><sub id='3Z6UK'></sub></form><legend id='3Z6UK'></legend><bdo id='3Z6UK'><pre id='3Z6UK'><center id='3Z6UK'></center></pre></bdo></b><th id='3Z6UK'></th></span></q></dt></tr></i><div id='3Z6UK'><tfoot id='3Z6UK'></tfoot><dl id='3Z6UK'><fieldset id='3Z6UK'></fieldset></dl></div>
                    <tfoot id='3Z6UK'></tfoot>
                      <bdo id='3Z6UK'></bdo><ul id='3Z6UK'></ul>