我试图一次检索整个文档和字段集合,然后将所有字段保存到用户存储中,最好像user.storage.document_name.field_name =“ field info”
这可能吗,到目前为止是否已正确设置此代码?
var textRef = db.collection('text');
var allQuestions = textRef.get()
.then(snapshot => {
snapshot.forEach(doc => {
const promises = [];
const p = doc.data();
promises.push(p)
console.log(doc.id, '=>', doc.data());
conv.user.storage.doc.id = doc.data();
});
return Promise.all(promises);
})
.catch(err => {
console.log('Error getting documents', err);
});