我似乎无法在Cloud函数中合并两个“ where”子句(Firestore文档未更新)。如果有人能指出我要去哪里,将不胜感激。
return admin.firestore().collection('/events/')
// .where('data','<',new Date()).where('published','==',true) // Doesn't work (multiple)
// .where('data',new Date()) // Works (single)
// .where('published',true) // Works (single)
.get().then(
(result: any) => {
if (result.size > 0) {
result.forEach(async (doc: any) => {
await doc.ref.update({
'published': false,})
await sgMail.send(msg);
})
}
谢谢!