voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
31 lines (17 loc) • 1.23 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/database](./database.md) > [orderByChild](./database.orderbychild.md)
## orderByChild() function
Creates a new `QueryConstraint` that orders by the specified child key.
Queries can only order by one key at a time. Calling `orderByChild()` multiple times on the same query is an error.
Firebase queries allow you to order your data by any child key on the fly. However, if you know in advance what your indexes will be, you can define them via the .indexOn rule in your Security Rules for better performance. See the[https://firebase.google.com/docs/database/security/indexing-data](https://firebase.google.com/docs/database/security/indexing-data) rule for more information.
You can read more about `orderByChild()` in [Sort data](https://firebase.google.com/docs/database/web/lists-of-data#sort_data)<!-- -->.
<b>Signature:</b>
```typescript
export declare function orderByChild(path: string): QueryConstraint;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| path | string | The path to order by. |
<b>Returns:</b>
[QueryConstraint](./database.queryconstraint.md)