【发布时间】:2020-11-19 16:14:53
【问题描述】:
这里的usersList包含人的用户名列表,androidNotificationToken是用户文档中包含发送通知令牌的字段。
const registrationTokens=[];
const indexOfSender=usersList.indexOf(senderUsername); // to remove the name of person sending message
let removedUsername=usersList.splice(indexOfSender,1);
usersList.forEach(async(element)=>{
const userRef = admin.firestore().collection('users').where("username","==",element);
const doc = await userRef.get();
registrationTokens.push(doc.data().androidNotificationToken);
});
TypeError: doc.data is not a function
at usersList.forEach (/workspace/index.js:191:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
【问题讨论】:
-
在 Stack Overflow 上,请不要显示文字图片。将文本复制到问题中,以便于阅读、复制和搜索。
-
好的,下次我会处理的
-
这次您可以通过编辑问题来删除屏幕截图并添加文本来做到这一点。问题底部有一个编辑链接。
-
将图片改为文字
标签: javascript node.js google-cloud-firestore google-cloud-functions