The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/database > orderByChild

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 thehttps://firebase.google.com/docs/database/security/indexing-data rule for more information.

You can read more about orderByChild() in Sort data.

Signature:

export declare function orderByChild(path: string): QueryConstraint;

Parameters

Parameter Type Description
path string The path to order by.

Returns:

QueryConstraint