Skip to content

I don't understand PossiblyReadAsUndefined when writing #104

Answered by tylim88
lazakrisz asked this question in Q&A
Discussion options

You must be logged in to vote

there is no optional field, all fields must have a default value when you create them for the first time using setDoc

reason behind this design decision:

Optional is a highly requested feature because of how common it is, however because of how Firestore works: it is impossible to query a missing field. Example: it is impossible to query user that has no phone number if phone number field does not exist. Because of this, it is important to make sure every field exists. You may not need the field now, but you may need it later plus adding default value is simple, especially with such powerful typing library like Firelord. So in order to not accidentally cripple your query in the future, I…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lazakrisz
Comment options

Answer selected by lazakrisz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants