I have a cloud function to increment a counter, only if certain fields change within the snapshot ('exercises' in this case).
In my cloud function, I have this check that always fires for some reason:
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...
}
And the log statements are identical:
[ { exerciseId: '-LZ7UD7VR7ydveVxqzjb',
title: 'Barbell Bench Press' } ] // List of exercise objects
[ { exerciseId: '-LZ7UD7VR7ydveVxqzjb',
title: 'Barbell Bench Press' } ] // Same list of exercise objects
What can I do to ensure that these values within the snapshot get treated as equal?
Thank you.