Ad
Firestore Unique ID's Generates By The Machine Or On The Backend When Using Set?
I need to know whether the unique id's generated by the Firestore is generated locally or on the backend? I can guess it's being generated locally because the following example
DocumentReference ref = db.collection("collection_name").document();
String id = ref.getId();
Or am I wrong and the create of the reference actually calling the server to allocate space and generate an ID?
Ad
Answer
The auto-IDs generated by Firestore are generated in your client-side code. This is actually quite important, because that means they'll also work when your Android device doesn't have a connection to the server.
There is no concept of reserving blocks of IDs. Instead uniqueness is ensured by having enough entropy in the ID. Essentially: it's a sufficiently long and random that chances of two clients generating the same ID are incredibly small.
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad