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

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

## setPriority() function

Sets a priority for the data at this Database location.

Applications need not use priority but can order collections by ordinary properties (see [Sorting and filtering data](https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data) ).

<b>Signature:</b>

```typescript
export declare function setPriority(ref: Reference, priority: string | number | null): Promise<void>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ref | [Reference](./database.reference.md) | The location to write to. |
|  priority | string \| number \| null | The priority to be written (string, number, or null). |

<b>Returns:</b>

Promise&lt;void&gt;

Resolves when write to server is complete.

