Firestore/src/DocumentReference.php
public function set(array $fields, array $options = [])
    {
        return $this->writeResult(
            $this->batchFactory()
                ->set($this->name, $fields, $options)
                ->commit($options)
        );
    }
public function set(array $fields, array $options = [])
    {
        return $this->writeResult(
            $this->batchFactory()
                ->set($this->name, $fields, $options)
                ->commit($options)
        );
    }
public function set ( array $ fields , array $ options = [ ] ) { return $ this -> writeResult ( $ this -> batchFactory ( ) -> set ( $ this -> name , $ fields , $ options ) -> commit ( $ options ) ) ; }
Write to a Firestore document, with optional merge behavior.

This method will create the document if it does not already exist.

Unless `$options.merge` is set to true, this method will replace all
existing document data.

Example:
```
$document->set([
'name' => 'Dave'
]);
```

@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Commit Commit
@codingStandardsIgnoreEnd

@param array $fields An array containing fields, where keys are the field
names, and values are field values. Nested arrays are allowed.
Note that unlike {@see Google\Cloud\Firestore\DocumentReference::update()},
field paths are NOT supported by this method.
@param array $options {
Configuration Options

@type bool $merge If true, unwritten fields will be preserved.
Otherwise, they will be overwritten (removed). **Defaults to**
`false`.
}
@codingStandardsIgnoreStart
@return array [WriteResult](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.WriteResult)
@codingStandardsIgnoreEnd
Write to a Firestore document with optional merge behavior .