voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
32 lines (18 loc) • 1.67 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/database](./database.md) > [equalTo](./database.equalto.md)
## equalTo() function
Creates a `QueryConstraint` that includes children that match the specified value.
Using `startAt()`<!-- -->, `startAfter()`<!-- -->, `endBefore()`<!-- -->, `endAt()` and `equalTo()` allows you to choose arbitrary starting and ending points for your queries.
The optional key argument can be used to further limit the range of the query. If it is specified, then children that have exactly the specified value must also have exactly the specified key as their key name. This can be used to filter result sets with many matches for the same value.
You can read more about `equalTo()` in [Filtering data](https://firebase.google.com/docs/database/web/lists-of-data#filtering_data)<!-- -->.
<b>Signature:</b>
```typescript
export declare function equalTo(value: number | string | boolean | null, key?: string): QueryConstraint;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| value | number \| string \| boolean \| null | The value to match for. The argument type depends on which <code>orderBy*()</code> function was used in this query. Specify a value that matches the <code>orderBy*()</code> type. When used in combination with <code>orderByKey()</code>, the value must be a string. |
| key | string | The child key to start at, among the children with the previously specified priority. This argument is only allowed if ordering by child, value, or priority. |
<b>Returns:</b>
[QueryConstraint](./database.queryconstraint.md)