insert method

Future<void> insert (
  1. {@required Map<String, Object> data,
  2. Reach reach: Reach.regional}
)

Inserts the document.

If the document exists already, the method will throw DatabaseException.found.

Optional parameter reach can be used to specify the minimum level of authority needed. For example:

  • Reach.local tells that the write only needs to reach the local database (which may synchronized with the global database later).
  • Reach.global tells that the write should reach the global master database.

Implementation

Future<void> insert({
  @required Map<String, Object> data,
  Reach reach = Reach.regional,
}) async {
  return DocumentInsertRequest(
    collection: null,
    document: this,
    data: data,
    reach: reach,
  ).delegateTo(parentDatabase.adapter);
}