/**
* Commit all mutations
*
* Calling this method will end the operation (and close the transaction,
* if one is specified).
*
* @param array $options [optional] {
* Configuration Options
*
* @type string $transaction The transaction ID, if the query should be
* run in a transaction.
* }
* @return array [Response Body](https://cloud.google.com/datastore/reference/rest/v1/projects/commit#response-body)
*/
public function commit(array $options = [])
{
$options += ['transaction' => null];
$res = $this->connection->commit($options + ['mode' => $options['transaction'] ? 'TRANSACTIONAL' : 'NON_TRANSACTIONAL', 'mutations' => $this->mutations, 'projectId' => $this->projectId]);
$this->mutations = [];
return $res;
}