I was in need of a database for filtering a huge list of elements I got (almost 6700 elements) using React Native. I was thinking about using a .JSON and send it over to Firebase Storage, but later on I found out that Firebase Realtime Database might be a better solution. However, I need to make queries with that list.
Here is a chunk of the .JSON list I got that I imported into Realtime Database:
[
{
"airport_name": "Goroka",
"city": "Goroka",
"country": "Papua New Guinea",
"utc": "10.00",
"continent": "U",
},
{
"airport_name": "Madang",
"city": "Madang",
"country": "Papua New Guinea"
"utc": "10.00",
"continent": "U",
},
...
//Repeat for more 6686 elements.
]
I need to make a query with Firebase Realtime Database where as the user type in a value in a search bar and the system should return elements that matches such value in the fields 'airport_name', 'city' and 'country' at the same time in a single query. Is that possible?
Also, I am having trouble trying to return a simple query like below:
const airportDbReference = database().ref('/');
async searchAirportByValue(value) {
return await airportDbReference
.orderByChild('country')
.equalTo(value)
.once('value')
.then((snapshot) => {
console.log(snapshot);
});
}
This always returning null for me. It's worth noting that I am using React Native Firebase for the Firebase connection. It's almost 6700 nodes inside the .JSON file, editing each individual note by hand would be out of question.
I appreciate the help! Thanks!