How do I get the created firestore document id?
What I have tried with no success: const db = firebase.firestore();
db.collection("my_collection").doc().set({
data: data
})
.then(docRef => {
console.log(docRef);
})
.catch((error) => {
// catch error
});
This always gives me undefined with the docRef
I have also tried the following .then
options: .then(function(docRef) { ... }
and .then((docRef) => { ... }
Am I missing something?
Thanks in advance.