У меня есть облачная функция firebase, которая создает транзакцию, которая создает документ, и я хочу в той же транзакции получить идентификатор документа и обновить другой документ со ссылкой на этот документ.
return db.runTransaction(t => {
return t.get(userDocRef)
.then(userDoc => {
var userDocData = userDoc.data();
let ref = db.collection('colect').doc();
return t.set(ref, {'userinfo' : userDocData.name});
}
.then(resp => {
// here `$resp` is reference to transaction and not to the resulted document
// here i want a reference to the new document or the id
// of the document or a way of knowing which document was inserted
}
})