insert method

Pipeline insert({
  1. Object? collection,
  2. Object? documentId,
  3. Map<String, Object?>? rawOptions,
})

Creates a document from every input; fails with already-exists if one of them exists.

collection (a path or a CollectionReference) is where the documents are created; without it they are created where the inputs were read from. documentId (a field name or an Expression) gives the id of each new document; without it the server assigns ids. See delete for how write stages behave.

Implementation

Pipeline insert({
  Object? collection,
  Object? documentId,
  Map<String, Object?>? rawOptions,
}) {
  return _append(
    Stage(
      'insert',
      options: _writeTarget('insert', collection, documentId),
      rawOptions: rawOptions,
    ),
  );
}