Package | com.myflashlab.air.extensions.firebase.firestore |
Class | public class DocumentReference |
Inheritance | DocumentReference flash.events.EventDispatcher |
Property | Defined By | ||
---|---|---|---|
documentId : String [read-only] | DocumentReference | ||
parent : CollectionReference [read-only]
Gets a CollectionReference to the collection that contains this document. | DocumentReference | ||
path : String [read-only]
Gets the path of this document (relative to the root of the database) as a slash-separated string. | DocumentReference |
Method | Defined By | ||
---|---|---|---|
addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void [override] | DocumentReference | ||
addSnapshotListener($onSuccess:Function, $onFailure:Function, $metadataChanges:String = null):void
Starts listening to the document referenced by this DocumentReference with the given options. | DocumentReference | ||
collection($collectionPath:String):CollectionReference
Gets a CollectionReference instance that refers to the subcollection at the specified path relative to this
document. | DocumentReference | ||
omit():void
Deletes the document referred to by this DocumentReference. | DocumentReference | ||
read($source:String):void
Reads the document referenced by this DocumentReference. | DocumentReference | ||
removeEventListener($type:String, $listener:Function, $useCapture:Boolean = false):void [override] | DocumentReference | ||
removeSnapshotListener($onSuccess:Function, $onFailure:Function):void
remove an already registered snapshotListener. | DocumentReference | ||
update($data:Object):void
Updates fields in the document referred to by this DocumentReference. | DocumentReference | ||
write($data:Object, $options:SetOptions = null):void
Writes to the document referred to by this DocumentReference. | DocumentReference |
documentId | property |
documentId:String
[read-only] public function get documentId():String
parent | property |
parent:CollectionReference
[read-only] Gets a CollectionReference to the collection that contains this document.
public function get parent():CollectionReference
path | property |
path:String
[read-only] Gets the path of this document (relative to the root of the database) as a slash-separated string.
public function get path():String
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 the document referenced by this DocumentReference 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.documentSnapshot 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 ) — Indicates whether metadata-only changes should trigger snapshot events or not.
|
myDocument.addSnapshotListener(onSnapshotListenerSuccess, onSnapshotListenerFailure); function onSnapshotListenerSuccess(e:FirestoreEvents):void { trace("onSnapshotListenerSuccess: "+JSON.stringify(e.documentSnapshot.data)); } function onSnapshotListenerFailure(e:FirestoreEvents):void { trace("onSnapshotListenerFailure: "+e.msg); }
collection | () | method |
public function collection($collectionPath:String):CollectionReference
Gets a CollectionReference instance that refers to the subcollection at the specified path relative to this document.
Parameters
$collectionPath:String — A slash-separated relative path to a subcollection.
|
CollectionReference — The CollectionReference instance.
|
omit | () | method |
public function omit():void
Deletes the document referred to by this DocumentReference. Result will be dispatched with
FirestoreEvents.DOCUMENT_DELETE_FAILURE
or FirestoreEvents.DOCUMENT_DELETE_SUCCESS
read | () | method |
public function read($source:String):void
Reads the document referenced by this DocumentReference. Result will be dispatched with
FirestoreEvents.DOCUMENT_GET_FAILURE
or FirestoreEvents.DOCUMENT_GET_SUCCESS
Parameters
$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 |
update | () | method |
public function update($data:Object):void
Updates fields in the document referred to by this DocumentReference. If no document exists yet, the update will
fail. Result will be dispatched with FirestoreEvents.DOCUMENT_UPDATE_FAILURE
or
FirestoreEvents.DOCUMENT_UPDATE_SUCCESS
Parameters
$data:Object — An object of field / value pairs to update. Fields can contain dots to reference nested fields
within the document.
|
write | () | method |
public function write($data:Object, $options:SetOptions = null):void
Writes to the document referred to by this DocumentReference. If the document does not yet exist, it will be
created. If you pass SetOptions, the provided data can be merged into an existing document. Result will be
dispatched with FirestoreEvents.DOCUMENT_SET_FAILURE
or
FirestoreEvents.DOCUMENT_SET_SUCCESS
Parameters
$data:Object — An object of the fields and values for the document.
| |
$options:SetOptions (default = null ) — An object to configure the set behavior.
|