<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/database](./database.md) &gt; [update](./database.update.md)

## update() function

Writes multiple values to the Database at once.

The `values` argument contains multiple property-value pairs that will be written to the Database together. Each child property can either be a simple property (for example, "name") or a relative path (for example, "name/first") from the current location to the data to update.

As opposed to the `set()` method, `update()` can be use to selectively update only the referenced properties at the current location (instead of replacing all the child properties at the current location).

The effect of the write will be visible immediately, and the corresponding events ('value', 'child\_added', etc.) will be triggered. Synchronization of the data to the Firebase servers will also be started, and the returned Promise will resolve when complete. If provided, the `onComplete` callback will be called asynchronously after synchronization has finished.

A single `update()` will generate a single "value" event at the location where the `update()` was performed, regardless of how many children were modified.

Note that modifying data with `update()` will cancel any pending transactions at that location, so extreme care should be taken if mixing `update()` and `transaction()` to modify the same data.

Passing `null` to `update()` will remove the data at this location.

See [Introducing multi-location updates and more](https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html)<!-- -->.

<b>Signature:</b>

```typescript
export declare function update(ref: Reference, values: object): Promise<void>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ref | [Reference](./database.reference.md) | The location to write to. |
|  values | object | Object containing multiple values. |

<b>Returns:</b>

Promise&lt;void&gt;

Resolves when update on server is complete.

