Firestore/src/DocumentReference.php
public function create(array $fields = [], array $options = [])
    {
        return $this->writeResult(
            $this->batchFactory()
                ->create($this->name, $fields, $options)
                ->commit($options)
        );
    }
public function create(array $fields = [], array $options = [])
    {
        return $this->writeResult(
            $this->batchFactory()
                ->create($this->name, $fields, $options)
                ->commit($options)
        );
    }
public function create ( array $ fields = [ ] , array $ options = [ ] ) { return $ this -> writeResult ( $ this -> batchFactory ( ) -> create ( $ this -> name , $ fields , $ options ) -> commit ( $ options ) ) ; }
Create a new document in Firestore.

If the document already exists, this method will fail.

Example:
```
$document->create([
'name' => 'John',
'country' => 'USA'
]);
```

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

@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.
@return array [WriteResult](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.WriteResult)
@codingStandardsIgnoreEnd
Create a new document in Firestore .