[cloud_firestore] I want to add new field to the document at the new version of my application #4010
Unanswered
KeepUpCode
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to add new field to the document at the new version of my application. But my last version of the application database didn't have this field.
For example, In the users collection, each user document have
name
andeemail
.In the new version of application, i need new field
phoneNumber
. But when I read the data I got an error :Bad state: field does not exist within the DocumentSnapshotPlatform
if there is a way to check if a property is present in a Cloud Firestore document. Something like
document.contains("phoneNumber")
or if there is a document property exist.Or should I run a code to add fields in the old db?
What would be the best practice to include in all the existing documents of the DB without losing their data on a new version of the app? Should I run an snippet just once to do this task or are there any better approaches to the problem?
Beta Was this translation helpful? Give feedback.
All reactions