Reputation: 1634
How can I change document ID in firebase? I have human readable document IDs which contains characters that are problematic, eg non latin or "-" which disappear after I deslugify them, how can i change them. I try to do it directly in the console but I don't seem to be able to, can i do it programatically?
Thanks
Upvotes: 1
Views: 703
Reputation: 133
No, once a document has been created, you cannot modify document ID's. See this question.
What you can do instead is read in the old document, create a new one with the ID you want and the data from the original, and then delete the original. You will want to do these actions within a transaction to make sure that they are completed in their entirety.
Upvotes: 2