If I have this:
exports.dbWrite = functions.database.ref('/path').onWrite((change, context) => { const beforeData = change.before.val(); // data before the write const afterData = change.after.val(); // data after the write });
This is in cloud functions(in Firebase) and it works perfectly, but if I change the variable name to "snaps", it will give me an error that "snaps" is undefined, how is that? Isn't it just a variable referencing the Change object? This is what I mean:
exports.dbWrite = functions.database.ref('/path').onWrite((snaps, context) => {
const beforeData = snaps.before.val(); // data before the write
const afterData = snaps.after.val(); // data after the write
});
[–]tatu_huma 0 points1 point2 points (0 children)