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

A CollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).



Public Properties
 PropertyDefined By
  collectionId : String
[read-only] The ID of the collection.
CollectionReference
  parent : DocumentReference
[read-only] Gets a DocumentReference to the document that contains this collection.
CollectionReference
  path : String
[read-only] Gets the path of this collection (relative to the root of the database) as a slash-separated string.
CollectionReference
Public Methods
 MethodDefined By
  
add($data:Object):void
Adds a new document to this collection with the specified data, assigning it a document ID automatically.
CollectionReference
 Inherited
addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void
[override]
Query
 Inherited
addSnapshotListener($onSuccess:Function, $onFailure:Function, $metadataChanges:String = null):void
Starts listening to this query with the given options (options can be null).
Query
  
document($documentPath:String = null):DocumentReference
Gets a DocumentReference instance that refers to the document at the specified path within this collection.
CollectionReference
 Inherited
endAt(... $fieldValues):Query
Creates and returns a new Query that ends at the provided fields relative to the order of the query.
Query
 Inherited
endBefore(... $fieldValues):Query
Creates and returns a new Query that ends before the provided fields relative to the order of the query.
Query
 Inherited
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
 Inherited
limitToLast($limit:Number):Query
Creates and returns a new {
Query
 Inherited
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
 Inherited
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
 Inherited
removeEventListener($type:String, $listener:Function, $useCapture:Boolean = false):void
[override]
Query
 Inherited
removeSnapshotListener($onSuccess:Function, $onFailure:Function):void
remove an already registered snapshotListener.
Query
 Inherited
startAfter(... $fieldValues):Query
Creates and returns a new Query that starts after the provided fields relative to the order of the query.
Query
 Inherited
startAt(... $fieldValues):Query
Creates and returns a new Query that starts at the provided fields relative to the order of the query.
Query
 Inherited
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
 Inherited
whereArrayContainsAny($field:String, $values:*):Query
Creates and returns a new {
Query
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
whereIn($field:String, $values:*):Query
Creates and returns a new {
Query
 Inherited
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
 Inherited
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
 InheritedASCENDING : int = 0
[static]
Query
 InheritedDESCENDING : int = 1
[static]
Query
Property Detail
collectionIdproperty
collectionId:String  [read-only]

The ID of the collection.


Implementation
    public function get collectionId():String
parentproperty 
parent:DocumentReference  [read-only]

Gets a DocumentReference to the document that contains this collection. Only subcollections are contained in a document. For root collections, returns null.


Implementation
    public function get parent():DocumentReference
pathproperty 
path:String  [read-only]

Gets the path of this collection (relative to the root of the database) as a slash-separated string.


Implementation
    public function get path():String
Method Detail
add()method
public function add($data:Object):void

Adds a new document to this collection with the specified data, assigning it a document ID automatically. Result will be dispatches with COLLECTION_ADD_SUCCESS or COLLECTION_ADD_FAILURE

Parameters

$data:Object — An object containing the data for the new document.

document()method 
public function document($documentPath:String = null):DocumentReference

Gets a DocumentReference instance that refers to the document at the specified path within this collection. If the document path is not provided, it returns a DocumentReference pointing to a new document with an auto-generated ID within this collection.

Parameters

$documentPath:String (default = null) — A slash-separated relative path to a document.

Returns
DocumentReference — The DocumentReference instance.