【发布时间】:2019-07-23 08:22:14
【问题描述】:
我想按时间填充用户并订购。但它不起作用。
await firebase
.firestore()
.collection('chats')
.where('users', 'array-contains', _usr.email)
.orderBy('lastmessage')
.onSnapshot(async res => {
const chats = res.docs.map(_doc => _doc.data());
await this.setState({
email: _usr.email,
chats: chats,
friends: []
});
})
错误是
Uncaught Error in onSnapshot: FirebaseError: The query requires an index. You can create it here
【问题讨论】:
-
你能解决这个问题吗?
标签: javascript firebase google-cloud-firestore