当触发对孩子

时间:2017-05-23 07:53:35

标签: firebase firebase-realtime-database google-cloud-functions

"devices" : {
"-KkdzvO6FNc2Ye6na2VP" : {
  "deviceId" : "-KkdzvO6FNc2Ye6na2VP",
  "deviceName" : "Lamp",
  "voltage" : {
    "1545" : "00",
    "2323" : 55,
    "7878" : 44,
    "45454" : "055.0",
    "787787" : 454,
    "1495481308" : 454545,
    "1495488208" : 5599,
    "1495516357" : 99,
    "date" : 1495476516
  }
},

我想检索' deviceName'在“电压”下添加的新孩子。 以下是我获得子键和值的方法。

   exports.test = functions.database
    .ref('/devices/{pushId}/voltage/{epoch}')
        .onWrite(event => {
            const epoch= event.params.epoch
            const value= event.data.val()
            const root = event.data.ref.root

        })

0 个答案:

没有答案