如何查询Firebase中的子键数组

时间:2017-06-12 16:12:50

标签: arrays firebase polymer polymerfire

假设我有这个数据结构:

{
  "posts": {
    "-KmRZyki4Z9I4oKEy5aD" : {
      "data1": "titel",
      "data2": "more text"
    },
    "-KmRZyki4Z9I4oKEy5aD" : {
      "data1": "other titel",
      "data2": "more text text text"
    },
    "-Dmk23sdaokI4oKEy5aD" : {
      "data1": "other titel2",
      "data2": "more text text text"
    }    
  },
    "geofire": {
      "-KmRAohOUaGfkMcWRN0p" : {
        ".priority" : "u30wy2cdfv",
        "g" : "u30wy2cdfv",
        "l" : [ 54.8161474, 32.2299636 ]
      },
      "-KmRZyki4Z9I4oKEy5aD" : {
        ".priority" : "u30wy2cdfv",
        "g" : "u30wy2cdfv",
        "l" : [ 53.8161474, 62.2299636 ]
      },
      "-Dmk23sdaokI4oKEy5aD" : {
        ".priority" : "u30wy2cdfv",
        "g" : "u30wy2cdfv",
        "l" : [ 12.8161474, 12.2299636 ]
      }
    }
  }
}  

现在我正在使用Geofire查询获取数组"结果"属于某个区域的节点密钥。让我们说这个数组看起来像这样:

results = ["-KmRAohOUaGfkMcWRN0p", "-KmRZyki4Z9I4oKEy5aD"];

我想使用Polymerfire元素来获取" posts"其中有一个键在结果数组中。我试着用这个:

<firebase-query
  id="query"
  path="/posts"
  data="{{postdata}}"
  child="[[results]]">    
</firebase-query>

但这不是支持者的方式。有人知道怎么做吗?

亲切的问候

chwzr lee

0 个答案:

没有答案