Composite Index warning message/link not appearing in console
samipshah100 opened this issue · comments
This is a warning. Just flagging it out for potential future users. Please delete if inappropriate.
I suggest it to be included in the readme for users or the warning message with the link to the composite index be logged to the developer's console.
I have a query where I use both where and orderBy clauses.
const { data: arr, mutate } = useCollection(
isLoggedIn ? `users` : null,
{
where: ['isJoined', '==', true],
orderBy: ['timestamp','desc'],
limit,
// 🚨 this is required to get access to the snapshot!
ignoreFirestoreDocumentSnapshotField: false,
},
)
In this case a composite index is needed for the query to return results.
Typically firestore will give you a warning in the console but using it as above does not generate the warning.
It is solved by manually creating a composite index in firestore.