How can we create a document with a custom id in firestore with the new modular SDK V9?
const register = async function (adminEmail){
try{
const docSnap = await getDoc(availableIdRef);
const collegeId = docSnap.data().id; //This should be the document id
const adminRef = collection(firestore, 'admin');
await addDoc(adminRef, {adminEmail, collegeId});
}catch(e){
alert("Error!");
}
}
I want to create a new document with id as collegeId
in admin
collection.
I know how to do this in web version 8(namespaced) but have no idea about web version 9(modular).