Why I'm Getting This error?:
FIREBASE WARNING: Using an unspecified index. Consider adding ".indexOn": "Keyboards" at / to your security rules for better performance
I have many Telegram Keyboards in my Firebase
1: I want to Fix This Error. ✔️
2: I Want to get and Console.log rock
and rocky
when telegram user typed rock
,
const ref = db.ref('Keyboards/rock'); //keyboard 1
const ref = db.ref('Keyboards/morning'); //keyboard 2
const ref = db.ref('Keyboards/rocky'); //keyboard 3
Rules:
{
"rules": {
".read": true,
".write": true,
"Keyboards" : {
".indexOn": "Keyboards"
}
}
}
Code:
const ref = db.ref('/');
ref.child('/').orderByChild('Keyboards').equalTo('rock').on("value", function(snapshot) {
console.log(snapshot.val());
key = snapshot.forEach(function(data) {
console.log(data.key);
});
});