Reputation: 2579
Currently the auto-id generates 20 digits unique code. I don't have that much data and I want to make it more efficient. So I want to see if I can ask Firestore to generate a 5 or 6 digits unique id for me.
Is that possible?
Upvotes: 2
Views: 1117
Reputation: 600061
The auto-generated IDs that Firestore can create are always going to be 20 characters long.
They are this long because Firestore uses their length to statistically guarantee they're unique: with this length there is no statistical chance that two clients will ever generate the same ID.
If you want to give your documents shorter IDs, you will:
This is definitely possible, but not built into any Cloud Firestore SDK, because the second step would significantly reduce performance, and also wouldn't work when the client is not connected to a server.
Upvotes: 3