Is there a way that I can get the auto-generated ID for a document created as part of a batch using Firestore?
When using .add()
I can easily get an ID:
In order to generate the uid automatically beforehand the creation of document, you can make use of createID() function from angularFireAuth as follows:
`
constructor(
private angularFireStore: AngularFirestore,
) {}
const batch = this.angularFireStore.firestore.batch();
const autogenUid = this.angularFireStore.createId();
const collectionReference = this.angularFireStore.collection
('collection_name').doc(autogenUid).ref;
const docData = {first_field:'value', second_field:'value2'};
batch.set(collectionReference, docData);