Skip to content

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

@samipshah100

Description

@samipshah100

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions