0

I am using a firebase Realtime database to store basic user info. One of which being their dislikes.

When trying to get the dislikes data, I require it to filter out the false values and only get the values that equal true. However when running it I get the error java.lang.Exception: Index not defined, add ".indexOn": ".value", for path "/users/dG9JqcX2WjgfZhJ3HOFGQyYNrs92/Dislikes", to the rules. I understand I have to add indexing to the path for this users dislikes to the rules for it to work however what about if another user with a different authentication key tries to access theirs? Won't this have a different path so the error will occur for that user until I add indexing for that section? Is there any way to add indexing to the entire database or automate adding the new path to the rules?

I get the dislikes data by using:

myRef.child(userid).child("Dislikes").orderByValue().equalTo(true).get().addOnSuccessListener {

And my database structure looks like this:

Database

Any and all help/tips are appreciated!

Joshu
  • 39
  • 7

0 Answers0