Reputation: 43617
I'm using react-firebase-hooks/firestore
and I have:
const [documents, documentsLoading, documentsError]: [DocumentInterface[], boolean, Error] = useCollectionDataOnce(
firebase.firestore().collection('documents')
.where('userId', '==', firebase.auth()?.currentUser?.uid || null)
.orderBy('updatedAt')
,
{ idField: 'id' }
)
which returns no results. If I remove the .orderBy('updatedAt')
, then I have results. Why would that be?
Upvotes: 0
Views: 498
Reputation: 1558
This query requires a composite index. If you check the console, the error will include a link that will automatically create it for you.
Upvotes: 2