I've seen many posts and solutions that are precisely what I need but when I implement it it doesn't work. I'm using the Firebase Realtime Database and I'm trying to search all "Name" children for a specific name. In this example I added the strings directly, but I'll be using a variable based on user input in the future. Here is my database structure as I see it in firebase:
{
"kjienk24dfwefn" : {
"FriendID" : "fr1959l9591i4925a",
"Name" : "Test Dummy2",
"email": "[email protected]",
"Status" : "InGame"
},
"kjienk24kdfiwne" : {
"FriendID" : "fr2812p8092m3604l",
"Name" : "Test Dummy",
"email":"[email protected]"
"Status" : "Online"
},
"kjienk24udfjjo" : {
"FriendID" : "fr7605h9204f8099g",
"Name" : "Test Dummy3",
"email": "[email protected]"
"Status" : "Offline"
}
}
And here is the code I'm using to query the "Name" (usersRef points to "firebase.database().ref()"). I've seen lots of examples of this online and I'm not sure what I'm doing incorrectly.
usersRef.orderByChild("Name").equalTo("Test Dummy").on("value", function(snapshot) {
//This is where I expect to see Test Dummy on the console.
console.log(snapshot.val())
});
EDIT: Here is the initialization of usersRef. Haven't had any problems reading and writing to the database. Standard firebaseConfig.:
const fbApp = firebase.initializeApp(firebaseConfig);
const db2 = fbApp.database("https://firebasedatabaseurl.com/")
const usersRef = db2.ref();
Thanks all in advance!

usersRefis initialized. - Frank van PuffelenusersRef? - Frank van Puffelen