Rya*_*yan 5 javascript firebase firebase-realtime-database google-cloud-functions
在Firebase上使用Cloud函数和onUpdate触发器时,如何检索已更新的记录(换句话说,触发该函数的记录)?我正在使用JavaScript与Firebase数据库进行交互。
传递给onUpdate处理函数的第一个参数是Change对象。该对象有两个属性,before和after,两个都是DataSnapshot对象。这些DataSnapshot对象描述了触发函数的更改前后的数据库内容。
exports.foo = functions.database.ref('/location-of-interest')
.onUpdate((change) => {
const before = change.before // DataSnapshot before the change
const after = change.after // DataSnapshot after the change
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5297 次 |
| 最近记录: |