Firebase.Database.Query

The Query class (and its subclass, DatabaseReference ) are used for reading data.

Summary

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.

Inheritance

Direct Known Subclasses:Firebase.Database.DatabaseReference

Properties

ChildAdded
EventHandler< ChildChangedEventArgs >
Add a handler for changes in the data at this location.
ChildChanged
EventHandler< ChildChangedEventArgs >
Add a handler for changes in the data at this location.
ChildMoved
EventHandler< ChildChangedEventArgs >
Add a handler for changes in the data at this location.
ChildRemoved
EventHandler< ChildChangedEventArgs >
Add a handler for changes in the data at this location.
Reference
A DatabaseReference to this location
ValueChanged
EventHandler< ValueChangedEventArgs >
Add a handler for changes in the data at this location.

Public functions

EndAt(string value)
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.
EndAt(double value)
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.
EndAt(bool value)
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.
EndAt(string value, string 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, and additionally only child nodes with a key key less than or equal to the given key.
EndAt(double value, string 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, and additionally only child nodes with a key less than or equal to the given key.
EndAt(bool value, string 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, and additionally only child nodes with a key less than or equal to the given key.
EqualTo(string value)
Create a query constrained to only return child nodes with the given value
EqualTo(double value)
Create a query constrained to only return child nodes with the given value
EqualTo(bool value)
Create a query constrained to only return child nodes with the given value.
EqualTo(string value, string key)
Create a query constrained to only return the child node with the given key and value.
EqualTo(double value, string key)
Create a query constrained to only return the child node with the given key and value.
EqualTo(bool value, string key)
Create a query constrained to only return the child node with the given key and value.
GetValueAsync()
KeepSynced(bool keepSynced)
void
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.
LimitToFirst(int limit)
Create a query with limit and anchor it to the start of the window
LimitToLast(int limit)
Create a query with limit and anchor it to the end of the window
OrderByChild(string path)
Create a query in which child nodes are ordered by the values of the specified path.
OrderByKey()
Create a query in which child nodes are ordered by their keys.
OrderByPriority()
Create a query in which child nodes are ordered by their priorities.
OrderByValue()
Create a query in which nodes are ordered by their value
StartAt(string value)
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.
StartAt(double value)
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.
StartAt(bool value)
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.
StartAt(string value, string 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, and additionally only child nodes with a key greater than or equal to the given key.
StartAt(double value, string 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, and additionally only child nodes with a key greater than or equal to the given key.
StartAt(bool value, string 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, and additionally only child nodes with a key greater than or equal to the given key.

Properties

ChildAdded

EventHandler< ChildChangedEventArgs > ChildAdded

Add a handler for changes in the data at this location.

Add a handler for changes in the data at this location. Each time time the data changes, your handler will be called with an immutable snapshot of the data.

ChildChanged

EventHandler< ChildChangedEventArgs > ChildChanged

Add a handler for changes in the data at this location.

Add a handler for changes in the data at this location. Each time time the data changes, your handler will be called with an immutable snapshot of the data.

ChildMoved

EventHandler< ChildChangedEventArgs > ChildMoved

Add a handler for changes in the data at this location.

Add a handler for changes in the data at this location. Each time time the data changes, your handler will be called with an immutable snapshot of the data.

ChildRemoved

EventHandler< ChildChangedEventArgs > ChildRemoved

Add a handler for changes in the data at this location.

Add a handler for changes in the data at this location. Each time time the data changes, your handler will be called with an immutable snapshot of the data.

Reference

DatabaseReference Reference

A DatabaseReference to this location

ValueChanged

EventHandler< ValueChangedEventArgs > ValueChanged

Add a handler for changes in the data at this location.

Add a handler for changes in the data at this location. Each time time the data changes, your handler will be called with an immutable snapshot of the data.

Public functions

EndAt

Query EndAt(
  string value
)

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.

Details
Parameters
value
The value to end at, inclusive
Returns
A Query with the new constraint

EndAt

Query EndAt(
  double value
)

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.

Details
Parameters
value
The value to end at, inclusive
Returns
A Query with the new constraint

EndAt

Query EndAt(
  bool value
)

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.

Details
Parameters
value
The value to end at, inclusive
Returns
A Query with the new constraint

EndAt

Query EndAt(
  string value,
  string 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, and additionally only child nodes with a key key less than or equal to the given key.

Details
Parameters
value
The value to end at, inclusive
key
The key to end at, inclusive
Returns
A Query with the new constraint

EndAt

Query EndAt(
  double value,
  string 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, and additionally only child nodes with a key less than or equal to the given key.

Details
Parameters
value
The value to end at, inclusive
key
The key to end at, inclusive
Returns
A Query with the new constraint

EndAt

Query EndAt(
  bool value,
  string 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, and additionally only child nodes with a key less than or equal to the given key.

Details
Parameters
value
The value to end at, inclusive
key
The key to end at, inclusive
Returns
A Query with the new constraint

EqualTo

Query EqualTo(
  string value
)

Create a query constrained to only return child nodes with the given value

Details
Parameters
value
The value to query for
Returns
A query with the new constraint

EqualTo

Query EqualTo(
  double value
)

Create a query constrained to only return child nodes with the given value

Details
Parameters
value
The value to query for
Returns
A query with the new constraint

EqualTo

Query EqualTo(
  bool value
)

Create a query constrained to only return child nodes with the given value.

Details
Parameters
value
The value to query for
Returns
A query with the new constraint

EqualTo

Query EqualTo(
  string value,
  string key
)

Create a query constrained to only return the child node with the given key and value.

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.

Details
Parameters
value
The value to query for
key
The key of the child
Returns
A query with the new constraint

EqualTo

Query EqualTo(
  double value,
  string key
)

Create a query constrained to only return the child node with the given key and value.

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.

Details
Parameters
value
The value to query for
key
The key of the child
Returns
A query with the new constraint

EqualTo

Query EqualTo(
  bool value,
  string key
)

Create a query constrained to only return the child node with the given key and value.

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.

Details
Parameters
value
The value to query for
key
The name of the child
Returns
A query with the new constraint

GetValueAsync

Task< DataSnapshot > GetValueAsync()

KeepSynced

void KeepSynced(
  bool keepSynced
)

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.

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.

Details
Parameters
keepSynced
Pass true to keep this location synchronized, pass false to stop synchronization.

LimitToFirst

Query LimitToFirst(
  int limit
)

Create a query with limit and anchor it to the start of the window

Details
Parameters
limit
The maximum number of child nodes to return
Returns
A Query with the new constraint

LimitToLast

Query LimitToLast(
  int limit
)

Create a query with limit and anchor it to the end of the window

Details
Parameters
limit
The maximum number of child nodes to return
Returns
A Query with the new constraint

OrderByChild

Query OrderByChild(
  string path
)

Create a query in which child nodes are ordered by the values of the specified path.

Details
Parameters
path
The path to the child node to use for sorting
Returns
A Query with the new constraint

OrderByKey

Query OrderByKey()

Create a query in which child nodes are ordered by their keys.

Details
Returns
A Query with the new constraint

OrderByPriority

Query OrderByPriority()

Create a query in which child nodes are ordered by their priorities.

Details
Returns
A Query with the new constraint

OrderByValue

Query OrderByValue()

Create a query in which nodes are ordered by their value

Details
Returns
A Query with the new constraint

StartAt

Query StartAt(
  string value
)

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.

Details
Parameters
value
The value to start at, inclusive
Returns
A Query with the new constraint

StartAt

Query StartAt(
  double value
)

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.

Details
Parameters
value
The value to start at, inclusive
Returns
A Query with the new constraint

StartAt

Query StartAt(
  bool value
)

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.

Details
Parameters
value
The value to start at, inclusive
Returns
A Query with the new constraint

StartAt

Query StartAt(
  string value,
  string 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, and additionally only child nodes with a key greater than or equal to the given key.

Details
Parameters
value
The priority to start at, inclusive
key
The key to start at, inclusive
Returns
A Query with the new constraint

StartAt

Query StartAt(
  double value,
  string 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, and additionally only child nodes with a key greater than or equal to the given key.

Details
Parameters
value
The priority to start at, inclusive
key
The key name to start at, inclusive
Returns
A Query with the new constraint

StartAt

Query StartAt(
  bool value,
  string 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, and additionally only child nodes with a key greater than or equal to the given key.

Details
Parameters
value
The priority to start at, inclusive
key
The key to start at, inclusive
Returns
A Query with the new constraint

Send feedback about...

Need help? Visit our support page.