2

I am using the new Firestore query feature

firebase.firestore().collection("articles").where("tags", "array-contains", tag)

to query all the article with specific tags.

The query works fine but the result is not sorted.

I understand how database indexes work and use them with other string fields before but not yet with array type.

When I do the query

firebase.firestore().collection("articles").orderBy("publishTime", "desc").where("tags", "array-contains", tag)

It prompts a link to create index. But that link does not work.

Is this because the new feature is still under development or is there any special step for "array-contains" query type?

2
  • Are you still having this problem? Commented Aug 14, 2018 at 19:54
  • It is resolved. Now I can use the provided link to create index under type ARRAY. Commented Aug 15, 2018 at 10:21

1 Answer 1

2

This is now resolved by create the index field under ARRAY type New Firestore index feature

Sign up to request clarification or add additional context in comments.

1 Comment

But I still can see the error on my console + it doesn't filter out the documents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.