'Is there a way to reduce Firebase Firestore auto generated Document ID?

I have a document id autogenerated like Abxns67X8XasVCBXg5Sxk89oNa2nx and would like to convert it to something like gx7XNv ( a six digit Id).



Solution 1:[1]

I found a workaround, by using firebase firestre transaction by using my own ids for documents . Those ids where just Timestamp and to make sure there is not conflict with ids i used firestore runTransaction to make sure there is no other document which where using the same id i was about to insert. If there is , then i use a random 3 digit number to concatenate to that id. When done, i could reduce the id length from 16 to 7 as they were numbers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ingenious_Hans