Data in db.patch() gets overwritten, even though its not defined?
Hey, when using db.patch() and passing in the args i wanna patch from, one of my fields in this case thumbnailId and thumbnailUrl gets removed? Even though they arent defined, so i would expect that they get ignored?
I might be overlooking something very obvious, but have been tryna fix this for a bit now without luck.
3 Replies
Are the fields in the
snippet
?
A year ago we did a deep patch, but that had pretty unexpected consequences, so the behavior is now (and has been since 1.0 at least) that it's a shallow patch. It only replaces the top-level fields. You can safely (and with the same performance) do:
Thanks for the heads up! I was un aware what shallow patch meant exactly, but makes sense now.
I'm assuming this is also a valid approach performance wise then?:
Yes, that works too. 🎂