Я развернул функцию в Firebase. Db использовал Firestore. Ошибка при входе в журналы
Error getting documents: TypeError: querySnapshot.forEach is not a function
at /srv/lib/index.js:147:23
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Попытка получить assignBy из коллекции todos
Моя функция:
// get todos collection docid when oncreate happens in todoscomments collection
exports.insert_Notifi_ontrig_todoscomments = functions.firestore
.document('todoscomments/{todoscommentsId}')
.onCreate(
async (snapshot: { data: () => { (): any; new(): any; message: any; taskid: any; from: any; fromName: any; }; },context:any) => {
// todos details.
const text = snapshot.data();
const taskid = text.taskid; // this is docid of todos collection
//get data of todos doc
const query3 = admin.firestore().collection('todos').doc(taskid)
await query3.get()
.then(function(querySnapshot: any[]) {
querySnapshot.forEach(doc=> {
const assignBy = doc.data().assignBy;
console.log(assignBy);
});
})
.catch(function(error: any) {
console.log("Error getting documents: ", error);
});
});
Я хочу получить значение assignBy, приложив снимок экрана todos