Packagecom.myflashlab.air.extensions.firebase.firestore
Classpublic class WriteBatch
InheritanceWriteBatch Inheritance flash.events.EventDispatcher

A write batch, used to perform multiple writes as a single atomic unit. A Batch object can be acquired by calling Firestore.batch(). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until commit() is called.

Unlike transactions, write batches are persisted offline and therefore are preferable when you don't need to condition your writes on read data.



Public Methods
 MethodDefined By
  
commit($listenForCallback:Boolean = true):void
Commits all of the writes in this write batch as a single atomic unit.
WriteBatch
  
omit($document:DocumentReference):void
Deletes the document referred to by the provided DocumentReference.
WriteBatch
  
update($document:DocumentReference, $data:Object):void
Updates fields in the document referred to by the provided DocumentReference.
WriteBatch
  
write($document:DocumentReference, $data:Object, $options:SetOptions = null):void
Writes to the document referred to by the provided DocumentReference.
WriteBatch
Method Detail
commit()method
public function commit($listenForCallback:Boolean = true):void

Commits all of the writes in this write batch as a single atomic unit. Commit result will be dispatched through FirestoreEvents.BATCH_SUCCESS or FirestoreEvents.BATCH_FAILURE.

Parameters

$listenForCallback:Boolean (default = true) — by default this is set to true, when set, completion events will be dispatched.

omit()method 
public function omit($document:DocumentReference):void

Deletes the document referred to by the provided DocumentReference.

Parameters

$document:DocumentReference — The DocumentReference to delete.

update()method 
public function update($document:DocumentReference, $data:Object):void

Updates fields in the document referred to by the provided DocumentReference. If no document exists yet, the update will fail.

Parameters

$document:DocumentReference — The DocumentReference to update.
 
$data:Object — An Object to update. Fields can contain dots to reference nested fields within the document.

write()method 
public function write($document:DocumentReference, $data:Object, $options:SetOptions = null):void

Writes to the document referred to by the provided 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.

Parameters

$document:DocumentReference — The DocumentReference to overwrite.
 
$data:Object — An Object of the fields and values for the document.
 
$options:SetOptions (default = null) — An object to configure the set behavior.