-
|
I'm trying to perform a simple query that looks like this: I get a Firebase error saying I need a collection group index. Why? Isn't this a basic query that is supported without adding any additional indexes? The questions collection is top level, and the text field is a top-level field for my documents. EDIT: I think I figured it out. There is an optional parameter for the "from" method called "all_descendants". It is true by default. I set it to false, and I no longer require the index, as expected. Here is the working code: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
|
Not anymore, unfortunately. This is a Firebase requirement now: all queries require indexes. |
Beta Was this translation helpful? Give feedback.
-
|
@pndalal Hi, Anyway indexing should be always needed for any query regarding collections. The error you are getting should also print in console a link. If you click it (or copy/paste it) it will navigate you to the page where you can set the indexes. |
Beta Was this translation helpful? Give feedback.
@pndalal Hi,
I'm noticing that you are using two times the
.fromfunction.I suppose that your
.from("questions")is correct, but to use an operator you have to issue the.where()function on the query:Anyway indexing should be always needed for any query regarding collections. The error you are getting should also print in console a link. If you click it (or copy/paste it) it will navigate you to the page where you can set the indexes.