I would like to get all persons from the database where first name and last name is given by user input.
So far this is my code:
admin.database().ref('persons').orderByChild('Firstname').equalTo(firstName).limitToLast(1).once("value").then(function(snapshot) {
}
This code works filtering only Firstname, but I cant find any way of adding another Where Clause for Last name. I tried to add another orderBy but it does not seem working. Does the Realtime Database has to be this hard to make a simple query?
We can filter data in one of three ways: by child key, by key, or by value. A query starts with one of these parameters, and then must be combined with one or more of the following parameters: startAt , endAt , limitToFirst , limitToLast , or equalTo .
FireSQL is a library built on top of the official Firebase SDK that allows you to query Cloud Firestore using SQL syntax. It's smart enough to issue the minimum amount of queries necessary to the Firestore servers in order to get the data that you request.
To see your current Realtime Database connections and data usage, check the Usage tab in the Firebase console. You can check usage over the current billing period, the last 30 days, or the last 24 hours.
The short answer: you can't. The long answer: use Google's new Firestore database or perform the filtering on the client manually. See this answer for other options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With