Issue
Im working with my PHP & Firebase project
I have this query code below in my PHP file
$query = $ref->orderBy('date', 'DESC')->where("isDeleted", "=", false);
This give me a Exception FailedPreconditionException
and a message The query requires an index
follow by a composite index link
I tried to copy & paste the link provided, but nothing happen.
So I try to create a index in firebase console manually, with the
date as DESC
andisDeleted as ASC
and nothing happen.
Solution
The order of fields in an index does matter. orderBy()
usually comes after other query constraints like isDeleted: false
so the database has to order only those filtered entries. You can use the following index:
isDeleted ASC
date ASC
Answered By - Dharmaraj Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.