MutateInSpec.arrayInsert constructor

MutateInSpec.arrayInsert(
  1. String path,
  2. Iterable<Object?> values, {
  3. bool? createPath,
  4. bool? xattr,
})

Creates a MutateInSpec for inserting values at a specified location in an array in a document.

The path should specify a specific index in the array and the new values are inserted at this location.

When createPath is true, the path to the field will be created if it does not already exist. Defaults to false.

When xattr is true, this operation references the extended attribute data of the document. Otherwise, it references the document body. Defaults to false.

Implementation

factory MutateInSpec.arrayInsert(
  String path,
  Iterable<Object?> values, {
  bool? createPath,
  bool? xattr,
}) {
  return MutateInSpec._create(
    Opcode.arrayInsert,
    path,
    values,
    createPath: createPath,
    xattr: xattr,
    multipleValues: true,
  );
}