create method

Transaction create(
  1. DocumentReference documentRef,
  2. JSObject data
)

Retrieves multiple documents from Firestore. Holds a pessimistic lock on all returned documents.

The first argument is required and must be of type DocumentReference followed by any additional DocumentReference documents. If used, the optional ReadOptions must be the last argument.

@param {Array.<DocumentReference|ReadOptions>} documentRefsOrReadOptions The DocumentReferences to receive, followed by an optional field mask. @return A Promise that resolves with an array of resulting document snapshots. Create the document referred to by the provided DocumentReference. The operation will fail the transaction if a document exists at the specified location.

@param documentRef A reference to the document to be create. @param data The object data to serialize as the document. @throws Error If the provided input is not a valid Firestore document. @return This Transaction instance. Used for chaining method calls.

Implementation

// TODO: Is this possible in dart?
// getAll<AppModelType, DbModelType extends DocumentData>(
//   ...documentRefsOrReadOptions: Array<
//     DocumentReference<AppModelType, DbModelType> | ReadOptions
//   >
// ): Promise<Array<DocumentSnapshot<AppModelType, DbModelType>>>;

/// Create the document referred to by the provided `DocumentReference`.
/// The operation will fail the transaction if a document exists at the
/// specified location.
///
/// @param documentRef A reference to the document to be create.
/// @param data The object data to serialize as the document.
/// @throws Error If the provided input is not a valid Firestore document.
/// @return This `Transaction` instance. Used for chaining method calls.
external Transaction create(DocumentReference documentRef, JSObject data);