Nested object with all undefined
fields causes entire nested chain to be omitted
#1879
Labels
api: firestore
Issues related to the googleapis/nodejs-firestore API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Consider an operation like so:
With
ignoreUndefinedProperties: true
, I would have expected the result written to Firestore to beHowever the actual result is that the entire
a
→b
→c
nested chain is entirely omitted:Is this the intended behaviour?
I believe it is due to these lines below, which, when there are no other non-
undefined
fields in any of the objects, flows all the way up the chain causing the entire nested chain to be omitted.nodejs-firestore/dev/src/serializer.ts
Lines 205 to 207 in ac35b37
Essentially those lines mean than an object consisting entirely of
undefined
fields should be omitted (the object itself), rather than just serialised as an empty object.Tested on
@google-cloud/firestore
version:6.7.0
.The text was updated successfully, but these errors were encountered: