我想查询
DocumentReference
是的。
我试着做了以下事情:
var promise1 = admin.firestore().collection(`players/${id}/collection1`).get();
var promise2 = admin.firestore().collection(`players/${id}/collection2`).get();
return Promise.all(promise1, promise2)
但问题是,通过执行以下操作,我会得到以下错误:
typeerror:(var)[symbol.iterator]不是函数
at function.all(本地)
在exports.onsubmission.functions.firestore.document.oncreate(/user_code/index.js:671:20)
所以,我试着在下面筑巢,效果很好。
return admin.firestore().collection(`players/${id}/collection1`).get().then(foundersSnapshot => {
return admin.firestore().collection(`players/${id}/collection2`).get().then(metricsSnapshot => {
但是,在部署时我得到了警告
避免背信弃义
那么,在这种情况下,什么是最佳实践?我更希望通过
Promise.all
但没用。此外,它还将输出两个集合作为
then(results => {
所以,在这种情况下,我能安全地考虑
results[0]
作为“collection1”和“results[1]作为“collection2”?