Now you need to sit and think about this, why? The reason is that you are front a tipical problem in firebase.... Answer this questions:
- The
arrayOfElements
can be infinite?
- The
arrayOfElements
size can be less of 100 (for example)?
Why you need to answered this questions? Supose that you have an array of 10.000 items (or infinite items) if you use orderByChild("0").equalTo("Tag1")
the firebase database needs to reading all items to find the items have "Tag1", then your app/web needs more time and data to get result of this query, then here we need to start talk about normalize firebase database and it's time to create indexes, you can see my yesterday post that I explain it.
If your answer in second question is YES then you can use this command to get values orderByChild("0").equalTo("Tag1")
because the data consumed and time wasted is too low front other cases... You can solve this adding indexOn()
on firebase database rules. Analize your database and decide the best option.
Update
About your comment... If you doesn't have an id or don't need firebase unique id the best form to do this, for me is this one:
arrayOfElements{
tag1:"true",
tag2:"true"
}
And just get the keys as value.
Let me know if I have helped you and good programming!