jsonfirebasefirebase-realtime-databasepolymerfirebase-polymer

Polymer - Firebase - getting child_added Name


In polymer, I am READing a Firebase Table. I can populate the Object and retrieve the data. But I do not know how to get the Document name from the JSON...

This is example of my Data...

{
    "PF004" : {
      "BINTS01" : 1477921088227,
      "BINTS02" : "2016-10-31 09:38",
      "BinScanWeekNumber" : 45,
      "DriversInitials" : "lt",
      "MissionID" : "lt1477921031516",
      "Q10_FILL_LEVEL" : "01 - 010% -2",
      "Q20_BIN_STATUS" : "300 - ALL GOOD",
      "ValLat" : 27.0026283,
      "ValLong" : -82.1632471,
      "YearNumber" : 2016,
      "recorded" : false
    },
    "PF009" : {
      "BINTS01" : 1477938700818,
      "BINTS02" : "2016-10-31 14:31",
      "BinScanWeekNumber" : 45,
      "DriversInitials" : "lt",
      "MissionID" : "lt1477935967751",
      "Q10_FILL_LEVEL" : "09 - 090% -5",
      "Q20_BIN_STATUS" : "300 - ALL GOOD",
      "ValLat" : 27.4861796,
      "ValLong" : -82.4469888,
      "YearNumber" : 2016,
      "recorded" : false
    },
Observe the "PF004" first record.

In Chrome debuger, I get this.... "Firebase child_added: PF004 "

So I know that chrome see's this. I am looking for a way to print the Document ID.

This is what I have tried so far...

                  <div class="card-content">BIN = [[bin.ID]] </div>
                  <div class="card-content">BIN = [[bin.id]] </div>
                  <div class="card-content">BIN = [[bin.child_added]] </div>

I am usually doing Android and ObjC stuff... I really should know JS better than this... thanks...


Solution

  • If you're using <firebase-query> there should be a bin.$key property that contains e.g. PF004.