-
Notifications
You must be signed in to change notification settings - Fork 970
Closed
Labels
Description
I Know here is not good place to ask this question, but this is a pro question and I asked from Stackoverflow too , But someone Said: I can't do this with Firebase, I just want to know is there any way to solve this problem with Firebase?
I have many Telegram Keyboards in my Firebase, and I Want to Search Childs of Keyboards
that the user entered,
Forexample user entered rock
, I want to get each Keyboards contain rock, in This Example I have 3 Keyboards: morning
, rock
and rocky
.
const ref = db.ref('Keyboards/rock'); //keyboard 1
const ref = db.ref('Keyboards/morning'); //keyboard 2
const ref = db.ref('Keyboards/rocky'); //keyboard 3
How Can I get and console.log
: rock
and rocky
when user typed rock
? (only with this Data Structure).
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);
});
});
I have problem with my code and rules.
I Started a +100 bounty in Stackoverflow too: Link