【发布时间】:2019-03-07 06:16:28
【问题描述】:
我有一个云函数来增加一个计数器,只有当快照中的某些字段发生变化时(在本例中为“练习”)。
在我的云功能中,我有一个总是因为某种原因触发的检查:
const before = snapshot.before.data();
const after = snapshot.after.data();
if (before['exercises'] !== after['exercises']) {
console.log(before['exercises']);
console.log(after['exercises']);
// Increment the counter...
}
并且日志语句是相同的:
[ { exerciseId: '-LZ7UD7VR7ydveVxqzjb',
title: 'Barbell Bench Press' } ] // List of exercise objects
[ { exerciseId: '-LZ7UD7VR7ydveVxqzjb',
title: 'Barbell Bench Press' } ] // Same list of exercise objects
我可以做些什么来确保快照中的这些值被视为平等?
谢谢。
【问题讨论】:
标签: typescript google-cloud-firestore google-cloud-functions javascript-objects snapshot