set<T> method

Transaction set<T>(
  1. DocumentReference<T> docRef,
  2. T data,
  3. [SetOptions? options]
)

Queues a set operation for the given document.

Parameters:

  • docRef: The document reference.
  • data: The data to set.
  • options: Optional set options.

Returns: The Transaction instance for chaining.

Example:

transaction.set(docRef, {'field': 'value'});

Implementation

Transaction set<T>(DocumentReference<T> docRef, T data,
    [SetOptions? options]) {
  if (__status == -1) {
    throw Utils.oracledbErrorHandler(400, OracledbErrorMessages.transactionEnded, null);
  }
  options ??= SetOptions(merge: false);

  __operations.add({
    "method": "set",
    "docRef": docRef,
    "data": data,
    "options": options,
    "version": __versions[docRef.path]
  });

  return this;
}