java.lang.Object | |
↳ | com.google.firebase.database.Query |
![]() |
The Query class (and its subclass, DatabaseReference
) are used for reading data.
Listeners are attached, and they will be triggered when the corresponding data changes.
Instances of Query are obtained by calling startAt(), endAt(), or limit() on a DatabaseReference.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a listener for child events occurring at this location.
| |||||||||||
Add a listener for a single change in the data at this location.
| |||||||||||
Add a listener for changes in the data at this location.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key key less than or equal to the given key.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key less than or equal to the given key.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value less than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key less than or equal to the given key.
| |||||||||||
Create a query constrained to only return the child node with the given key and value.
| |||||||||||
Create a query constrained to only return child nodes with the given value
| |||||||||||
Create a query constrained to only return the child node with the given key and value.
| |||||||||||
Create a query constrained to only return child nodes with the given value
| |||||||||||
Create a query constrained to only return the child node with the given key and value.
| |||||||||||
Create a query constrained to only return child nodes with the given value.
| |||||||||||
By calling `keepSynced(true)` on a location, the data for that location will automatically be
downloaded and kept in sync, even when no listeners are attached for that location.
| |||||||||||
Create a query with limit and anchor it to the start of the window
| |||||||||||
Create a query with limit and anchor it to the end of the window
| |||||||||||
Create a query in which child nodes are ordered by the values of the specified path.
| |||||||||||
Create a query in which child nodes are ordered by their keys.
| |||||||||||
Create a query in which child nodes are ordered by their priorities.
| |||||||||||
Create a query in which nodes are ordered by their value
| |||||||||||
Remove the specified listener from this location.
| |||||||||||
Remove the specified listener from this location.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key greater than or equal to the given key.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key greater than or equal to the given key.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default.
| |||||||||||
Create a query constrained to only return child nodes with a value greater than or equal to the
given value, using the given orderBy directive or priority as default, and additionally only
child nodes with a key greater than or equal to the given key.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Add a listener for child events occurring at this location. When child locations are added, removed, changed, or moved, the listener will be triggered for the appropriate event
Parameters | |
---|---|
listener |
ChildEventListener :
The listener to be called with changes |
Returns | |
---|---|
ChildEventListener |
A reference to the listener provided. Save this to remove the listener later. |
Add a listener for a single change in the data at this location. This listener will be triggered once with the value of the data at the location.
Parameters | |
---|---|
listener |
ValueEventListener :
The listener to be called with the data
|
Add a listener for changes in the data at this location. Each time time the data changes, your listener will be called with an immutable snapshot of the data.
Parameters | |
---|---|
listener |
ValueEventListener :
The listener to be called with changes |
Returns | |
---|---|
ValueEventListener |
A reference to the listener provided. Save this to remove the listener later. |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key key less than or equal to the given key.
Parameters | |
---|---|
value |
String :
The value to end at, inclusive |
key |
String :
The key to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
String :
The value to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key less than or equal to the given key.
Parameters | |
---|---|
value |
double :
The value to end at, inclusive |
key |
String :
The key to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
double :
The value to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
boolean :
The value to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value less than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key less than or equal to the given key.
Parameters | |
---|---|
value |
boolean :
The value to end at, inclusive |
key |
String :
The key to end at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return the child node with the given key and value. Note that there is at most one such child as names are unique.
Parameters | |
---|---|
value |
String :
The value to query for |
key |
String :
The key of the child |
Returns | |
---|---|
Query |
A query with the new constraint |
Create a query constrained to only return child nodes with the given value
Parameters | |
---|---|
value |
double :
The value to query for |
Returns | |
---|---|
Query |
A query with the new constraint |
Create a query constrained to only return the child node with the given key and value. Note that there is at most one such child as keys are unique.
Parameters | |
---|---|
value |
double :
The value to query for |
key |
String :
The key of the child |
Returns | |
---|---|
Query |
A query with the new constraint |
Create a query constrained to only return child nodes with the given value
Parameters | |
---|---|
value |
String :
The value to query for |
Returns | |
---|---|
Query |
A query with the new constraint |
Create a query constrained to only return the child node with the given key and value. Note that there is at most one such child as keys are unique.
Parameters | |
---|---|
value |
boolean :
The value to query for |
key |
String :
The name of the child |
Returns | |
---|---|
Query |
A query with the new constraint |
Create a query constrained to only return child nodes with the given value.
Parameters | |
---|---|
value |
boolean :
The value to query for |
Returns | |
---|---|
Query |
A query with the new constraint |
By calling `keepSynced(true)` on a location, the data for that location will automatically be downloaded and kept in sync, even when no listeners are attached for that location. Additionally, while a location is kept synced, it will not be evicted from the persistent disk cache.
Parameters | |
---|---|
keepSynced |
boolean :
Pass `true` to keep this location synchronized, pass `false` to stop
synchronization.
|
Create a query with limit and anchor it to the start of the window
Parameters | |
---|---|
limit |
int :
The maximum number of child nodes to return |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query with limit and anchor it to the end of the window
Parameters | |
---|---|
limit |
int :
The maximum number of child nodes to return |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query in which child nodes are ordered by the values of the specified path.
Parameters | |
---|---|
path |
String :
The path to the child node to use for sorting |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query in which child nodes are ordered by their keys.
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query in which child nodes are ordered by their priorities.
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query in which nodes are ordered by their value
Returns | |
---|---|
Query |
A Query with the new constraint |
Remove the specified listener from this location.
Parameters | |
---|---|
listener |
ChildEventListener :
The listener to remove
|
Remove the specified listener from this location.
Parameters | |
---|---|
listener |
ValueEventListener :
The listener to remove
|
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
double :
The value to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key greater than or equal to the given key.
Parameters | |
---|---|
value |
String :
The priority to start at, inclusive |
key |
String :
The key to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
String :
The value to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key greater than or equal to the given key.
Parameters | |
---|---|
value |
double :
The priority to start at, inclusive |
key |
String :
The key name to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default.
Parameters | |
---|---|
value |
boolean :
The value to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |
Create a query constrained to only return child nodes with a value greater than or equal to the given value, using the given orderBy directive or priority as default, and additionally only child nodes with a key greater than or equal to the given key.
Parameters | |
---|---|
value |
boolean :
The priority to start at, inclusive |
key |
String :
The key to start at, inclusive |
Returns | |
---|---|
Query |
A Query with the new constraint |