Packagecom.myflashlab.air.extensions.firebase.firestore
Classpublic class Query
InheritanceQuery Inheritance flash.events.EventDispatcher
Subclasses CollectionReference

A Query which you can read or listen to. You can also construct refined Query objects by adding filters and ordering.



Public Methods
 MethodDefined By
  
addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void
[override]
Query
  
addSnapshotListener($onSuccess:Function, $onFailure:Function, $metadataChanges:String = null):void
Starts listening to this query with the given options (options can be null).
Query
  
endAt(... $fieldValues):Query
Creates and returns a new Query that ends at the provided fields relative to the order of the query.
Query
  
endBefore(... $fieldValues):Query
Creates and returns a new Query that ends before the provided fields relative to the order of the query.
Query
  
limit($limit:Number):Query
Creates and returns a new Query that's additionally limited to only return up to the specified number of documents.
Query
  
limitToLast($limit:Number):Query
Creates and returns a new {
Query
  
orderBy($field:String, $direction:int):Query
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
Query
  
read($metadataChanges:String = null, $source:String):void
Executes the query and returns the results in FirestoreEvents.QUERY_GET_FAILURE and FirestoreEvents.QUERY_GET_SUCCESS
Query
  
removeEventListener($type:String, $listener:Function, $useCapture:Boolean = false):void
[override]
Query
  
removeSnapshotListener($onSuccess:Function, $onFailure:Function):void
remove an already registered snapshotListener.
Query
  
startAfter(... $fieldValues):Query
Creates and returns a new Query that starts after the provided fields relative to the order of the query.
Query
  
startAt(... $fieldValues):Query
Creates and returns a new Query that starts at the provided fields relative to the order of the query.
Query
  
whereArrayContains($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field, it must be an array, and the array must contain the provided value.
Query
  
whereArrayContainsAny($field:String, $values:*):Query
Creates and returns a new {
Query
  
whereEqualTo($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.
Query
  
whereGreaterThan($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.
Query
  
whereGreaterThanOrEqualTo($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value.
Query
  
whereIn($field:String, $values:*):Query
Creates and returns a new {
Query
  
whereLessThan($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value.
Query
  
whereLessThanOrEqualTo($field:String, $value:*):Query
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value.
Query
Public Constants
 ConstantDefined By
  ASCENDING : int = 0
[static]
Query
  DESCENDING : int = 1
[static]
Query
Method Detail
addEventListener()method
override public function addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void

Parameters

$type:String
 
$listener:Function
 
$useCapture:Boolean (default = false)
 
$priority:int (default = 0)
 
$useWeakReference:Boolean (default = false)

addSnapshotListener()method 
public function addSnapshotListener($onSuccess:Function, $onFailure:Function, $metadataChanges:String = null):void

Starts listening to this query with the given options (options can be null).

Parameters

$onSuccess:Function — The function to be called when data is retrived successfully. This function expects "one" parameter as follow. function onSnapshotListenerSuccess(e:FirestoreEvents):void Then you can use e.querySnapshot to access the received snapshot.
 
$onFailure:Function — The function to be called when there is an error. This function expects "one" parameter as follow. function onSnapshotListenerFailure(e:FirestoreEvents):void Then you can use e.msg to see the error message.
 
$metadataChanges:String (default = null) — The options to use for this listen.


Example
The following example shows how to work with transactions.
     myQuery.addSnapshotListener(onSnapshotListenerSuccess, onSnapshotListenerFailure);
     function onSnapshotListenerSuccess(e:FirestoreEvents):void
     {
         //e.querySnapshot
     }
      
     function onSnapshotListenerFailure(e:FirestoreEvents):void
     {
         trace("onSnapshotListenerFailure: "+e.msg);
     }
     
endAt()method 
public function endAt(... $fieldValues):Query

Creates and returns a new Query that ends at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

Parameters

... $fieldValues — The field values to end this query at, in order of the query's order by. values must be either: String, int, Number or Boolean

Returns
Query — The created Query.
endBefore()method 
public function endBefore(... $fieldValues):Query

Creates and returns a new Query that ends before the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

Parameters

... $fieldValues — The field values to end this query before, in order of the query's order by. values must be either: String, int, Number or Boolean

Returns
Query — The created Query.
limit()method 
public function limit($limit:Number):Query

Creates and returns a new Query that's additionally limited to only return up to the specified number of documents.

Parameters

$limit:Number — The maximum number of items to return.

Returns
Query — The created Query.
limitToLast()method 
public function limitToLast($limit:Number):Query

Creates and returns a new {

Parameters

$limit:Number — The maximum number of items to return.

Returns
Query — The created {
orderBy()method 
public function orderBy($field:String, $direction:int):Query

Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.

Parameters

$field:String — The field to sort by.
 
$direction:int (default = NaN) — The direction to sort. Query.ASCENDING or Query.DESCENDING

Returns
Query — The created Query.
read()method 
public function read($metadataChanges:String = null, $source:String):void

Executes the query and returns the results in FirestoreEvents.QUERY_GET_FAILURE and FirestoreEvents.QUERY_GET_SUCCESS

Parameters

$metadataChanges:String (default = null)
 
$source:String (default = NaN)

removeEventListener()method 
override public function removeEventListener($type:String, $listener:Function, $useCapture:Boolean = false):void

Parameters

$type:String
 
$listener:Function
 
$useCapture:Boolean (default = false)

removeSnapshotListener()method 
public function removeSnapshotListener($onSuccess:Function, $onFailure:Function):void

remove an already registered snapshotListener.

Parameters

$onSuccess:Function
 
$onFailure:Function

startAfter()method 
public function startAfter(... $fieldValues):Query

Creates and returns a new Query that starts after the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

Parameters

... $fieldValues — The field values to start this query after, in order of the query's order by. values must be either: String, int, Number or Boolean

Returns
Query — The created Query.
startAt()method 
public function startAt(... $fieldValues):Query

Creates and returns a new Query that starts at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

Parameters

... $fieldValues — The field values to start this query at, in order of the query's order by. values must be either: String, int, Number or Boolean

Returns
Query — The created Query.
whereArrayContains()method 
public function whereArrayContains($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field, it must be an array, and the array must contain the provided value.

A query can have only one arrayContains filter.

Parameters

$field:String
 
$value:*

Returns
Query
whereArrayContainsAny()method 
public function whereArrayContainsAny($field:String, $values:*):Query

Creates and returns a new {

Parameters

$field:String — The path of the field containing an array to search.
 
$values:* — The list that contains the values to match.

Returns
Query — The created {
whereEqualTo()method 
public function whereEqualTo($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.

Parameters

$field:String — The name of the field to compare
 
$value:* — The value for comparison. value must be either: String, int, Number or Boolean

Returns
Query — The created Query.
whereGreaterThan()method 
public function whereGreaterThan($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.

Parameters

$field:String — The name of the field to compare
 
$value:* — The value for comparison. value must be either: String, int, Number or Boolean

Returns
Query — The created Query.
whereGreaterThanOrEqualTo()method 
public function whereGreaterThanOrEqualTo($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value.

Parameters

$field:String — The name of the field to compare
 
$value:* — The value for comparison. value must be either: String, int, Number or Boolean

Returns
Query — The created Query.
whereIn()method 
public function whereIn($field:String, $values:*):Query

Creates and returns a new {

Parameters

$field:String — The name of the field to search.
 
$values:* — The list that contains the values to match.

Returns
Query — The created {
whereLessThan()method 
public function whereLessThan($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value.

Parameters

$field:String — The name of the field to compare
 
$value:* — The value for comparison. value must be either: String, int, Number or Boolean

Returns
Query — The created Query.
whereLessThanOrEqualTo()method 
public function whereLessThanOrEqualTo($field:String, $value:*):Query

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value.

Parameters

$field:String — The name of the field to compare
 
$value:* — The value for comparison. value must be either: String, int, Number or Boolean

Returns
Query — The created Query.
Constant Detail
ASCENDINGConstant
public static const ASCENDING:int = 0

DESCENDINGConstant 
public static const DESCENDING:int = 1