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 >
Event raised when children nodes are added relative to this location.
ChildChanged
EventHandler< ChildChangedEventArgs >
Event raised when children nodes are changed relative to this location.
ChildMoved
EventHandler< ChildChangedEventArgs >
Event raised when children nodes are moved relative to this location.
ChildRemoved
EventHandler< ChildChangedEventArgs >
Event raised when children nodes are removed relative to this location.
Reference
A DatabaseReference to this location
ValueChanged
EventHandler< ValueChangedEventArgs >
Event 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()
Task< DataSnapshot >
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

Event raised when children nodes are added relative to this location.

Register a handler to observe when children are added relative to this Query object. Each time time children nodes are added, your handler will be called with an immutable snapshot of the data.

ChildChanged

EventHandler< ChildChangedEventArgs > ChildChanged

Event raised when children nodes are changed relative to this location.

Register a handler to observe changes to children relative to this Query object. Each time time children nodes are changed, your handler will be called with an immutable snapshot of the data.

ChildMoved

EventHandler< ChildChangedEventArgs > ChildMoved

Event raised when children nodes are moved relative to this location.

Register a handler to observe when children are moved relative to this Query object. Each time time children nodes are moved, your handler will be called with an immutable snapshot of the data.

ChildRemoved

EventHandler< ChildChangedEventArgs > ChildRemoved

Event raised when children nodes are removed relative to this location.

Register a handler to observe when children are removed relative to this Query object. Each time time children nodes are removed, your handler will be called with an immutable snapshot of the data.

Reference

DatabaseReference Reference

A DatabaseReference to this location

ValueChanged

EventHandler< ValueChangedEventArgs > ValueChanged

Event for changes in the data at this location.

Register a handler to observe changes at the location of this Query object. 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.

Known issue This currently does not work properly on all platforms. Please use EndAt(string value) instead.

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.

Known issue This currently does not work properly on all platforms. Please use EndAt(double value) instead.

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.

Known issue This currently does not work properly on all platforms. Please use EndAt(bool value) instead.

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.

Known issue This currently does not work properly on iOS and tvOS. Please use EqualTo(string value) instead.

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.

Known issue This currently does not work properly on iOS and tvOS. Please use EqualTo(double value) instead.

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.

Known issue This currently does not work properly on iOS and tvOS. Please use EqualTo(bool value) instead.

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.

Known issue This currently does not work properly on all platforms. Please use StartAt(string value) instead.

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.

Known issue This currently does not work properly on all platforms. Please use StartAt(double value) instead.

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.

Known issue This currently does not work properly on all platforms. Please use StartAt(bool value) instead.

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