Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite Index warning message/link not appearing in console #113

Open
samipshah100 opened this issue Apr 23, 2021 · 0 comments
Open

Composite Index warning message/link not appearing in console #113

samipshah100 opened this issue Apr 23, 2021 · 0 comments

Comments

@samipshah100
Copy link

samipshah100 commented Apr 23, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant