This is what my database looks like..
{
"users":{
"user_id4243":{
"friends":{
"friend1_ID5321":1,
"friend2_ID5321":1,
"friend3_ID5321":1}
"sData":"some_data"
}
}
}
In the other words, I store user's friend's Id's, and try to filter users, using a friend ID.
Everything works perfectly, except it downloads the whole "friends" data, and does the filtering on the client side. I get logs saying(Android/iOS),
Consider adding '".indexOn": "friends/115883230405231926879"' at users to your security and Firebase Database rules...
But how should I do that with no static user ids? I've tried the following method, but it doesn't work as indexOn required only static path..
"users": {
"$user_id": {
"friends": {
".indexOn": "$user_id"
}
}
}
I've even tried adding another "ID" variable inside the friend id, but still no success..
"users": {
"$user_id": {
"friends": {
"$user_id": {
".indexOn": ["ID"]
}
}
}
}
Any idea how can I use .indexOn in this situation? Or how can I make a structure, where I'll be able to filter users, that will have certain ID inside..?