I am getting the [Error: [firestore/failed-precondition] The query requires an index. when i am adding the orderBy(‘createdAt’).
I am getting the following error when i am adding the orderBy(‘crearedAt’) on the firestore collection.
[Error: [firestore/failed-precondition] The query requires an index.
my collection is
[![export const CommentsCollection = firestore().collection('comments');][1]][1]
When i am adding the orderBy(‘createdAt’) like
let commentsQuery = CommentsCollection.orderBy('createdAt').where('postId', '==', data.postId);
I have already created the index on the firebase console.