This question already has answers here:
Query Firebase Database with two between conditions
(1 answer)
How to query Firebase for value between two keys
(2 answers)
Closed 3 years ago.
I'm trying to get all "par***" data sets where two dates are between "from" and "to" (x is greater than "from" and y is less than "to").
My Firebase structure is:
I'm using android with java and firebase realtime database.
Related
This question already has answers here:
Query based on multiple where clauses in Firebase
(8 answers)
Firebase multiple WHERE clause in query [duplicate]
(2 answers)
Closed 4 months ago.
First of all, I am coding in Kotlin.
I'd like to arrange the posts stored in the Realtime Database for a certain period of time based on the number of likes and display them in the RecyclerView.
my database structure
"posts": {
"key": {
"uid": "NHYVkW...",
"title" : "Title",
"time": "1666852764028",
"like" : 2
}
I've read about methods orderByChild(), startAt(), and endAt(), but I don't know how to use them in combination.
The examples I've seen set startAt() and endAt() for the key that enters orderByChild().
But I want the sort to be based on like and the start and end points based on time.
Any examples I can refer to?
Please help.
This question already has answers here:
How to sort Firebase records by two fields (Android) [duplicate]
(1 answer)
Query based on multiple where clauses in Firebase
(8 answers)
Closed 8 months ago.
I am trying to get data of "fromuser" equals to "moeez" and "status" equals to "pending" in firebase
using query
Query query1 = databaseReference.child("fromuser").equalTo(name).orderByChild("status").equalTo(status_value);
gives error java.lang.IllegalArgumentException: You can't combine multiple orderBy calls!
Now how can i retrieve both values at same time to display sorted data??
This question already has answers here:
How can i rename a branch/node in firebase
(3 answers)
How to update the node key in Firebase?
(1 answer)
How to copy a record from a location to another in Firebase realtime database?
(1 answer)
Closed 1 year ago.
I want to update root name of an item in firebase real time database.
How to do that?
reference.child(Name).setValue(updateItem);
This code create a new item with a new name.
This question already has answers here:
How to count the number of documents under a collection in Firestore?
(3 answers)
Cloud Firestore collection count
(29 answers)
How to get a count of number of documents in a collection with Cloud Firestore [duplicate]
(10 answers)
Closed 2 years ago.
Assume that I have a collection named "students" below:
collection students has 3 fields:
name
age
status (0: passed, 1: failed, -1: not tested)
('status' field describles the student passed or failed or Notyet tested)
The collection students has 1000 documents with different 'status'
Now I want to get the count of students who [passed/failed/not tested] the exam
And whenever 'status' of a student is updated 0/1/-1 then I will have to re-count.
How can I solve this?
I shouldn't query all data for everytime update because it will cause high cost. NOTICE that, I want to count base on the 'status' field.
This question already has answers here:
Firebase Android - startAt() and endAt() not working correctly?
(2 answers)
Closed 3 years ago.
I have objects named "trips" saved in the firebase database, which can uniquely identify using seasonCode and TripCode combination.
Now I want to retrieve all the trips which include a particular seasonCode (ex: trips with seasonCode="SeasonCose1"). but need to extract data set chunk wise. (let's say 10 trips at a time)
FirebaseDatabase.getInstance(firebaseApp).getReference("resources").child("trips").orderByChild("seasonCode").equalTo("seasonCode1").limitToFirst(10)
I figured this query returns first 10 trips wich seasonCode="SeasonCode1". if I have last retrieved "Trip" object, how can I retrieve the next 10 trips with seasonCode="seasonCode1"?
Finally found a solution. I can get that through wildcard queries.
Firebase Android - startAt() and endAt() not working correctly?