【发布时间】:2018-12-15 10:18:59
【问题描述】:
我有一个我认为是对名为“电子邮件”的集合的简单查询:
const emailQuery = admin
.firestore()
.collection('email')
.where('sendAt', '>=', new Date())
.where('orderId', '==', doc.orderId)
.where('brandId', '==', doc.brandId);
我收到这篇文章主题中的错误,表明我需要为此查询创建索引。我尝试为相关字段创建一对,但我不确定为什么需要它,因为只订购了一个字段 - 尽管有这些索引,但错误仍然存在:
sendAt -> Ascending, brandId -> Ascending, orderId -> Ascending
sendAt -> Descending, brandId -> Ascending, orderId -> Ascending
如您所见,我没有指定orderBy。另外,sendAt 是一个日期,而另外两个是不需要排序的简单字符串。
我需要什么样的索引,或者我该如何解决这个错误?
谢谢!
【问题讨论】:
标签: database firebase indexing google-cloud-firestore