I'm trying to get back some info about the document I just created/updated without making a second request.
I know that I get back a Document reference with the Id of the document, but I need additional info like createTime and updateTime.
Currently, this is the way I'm trying to achieve that, but I would like to spare that extra request since it's not very efficient.
const docRef = await database.collection('tagsCollection').add({
...input
createTime: firestore.FieldValue.serverTimestamp()
});
const doc = await docRef.get();
return {
...doc.data(),
id: doc.id,
createTime: doc.data().createTime.toMillis().toString()
};