Class: BaseQueryBuilder<MyDocType>
Query builder base class.
Type parameters
Name | Type |
---|---|
MyDocType | extends DocumentData |
Hierarchy
BaseQueryBuilder
Constructors
constructor
• new BaseQueryBuilder<MyDocType
>()
Type parameters
Name | Type |
---|---|
MyDocType | extends DocumentData |
Methods
eq
▸ eq(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '==', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
gt
▸ gt(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '>', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
gte
▸ gte(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '>=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
in
▸ in(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, 'in', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType [] | An array of values to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
like
▸ like(fieldName
, pattern
, caseSensitive?
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, 'like', pattern).
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
pattern | string | The pattern to compare against. '%' matches 0 or more characters. '' matches exactly one character. '\' can be used to escape '%', ''. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid. |
caseSensitive? | boolean | Whether to use case-sensitive comparison. Defaults to true. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
limit
▸ Abstract
limit(limit
): BaseQueryBuilder
<MyDocType
>
Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000 if none is provided.
Parameters
Name | Type | Description |
---|---|---|
limit | number | The limit to set. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
lt
▸ lt(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '<', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
lte
▸ lte(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '<=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
neq
▸ neq(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, '!=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
nin
▸ nin(fieldName
, value
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, 'not in', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
value | PrimitiveFieldType [] | An array of values to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
notLike
▸ notLike(fieldName
, pattern
, caseSensitive?
): BaseQueryBuilder
<MyDocType
>
A shortcut for where(fieldName, 'not like', pattern).
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
pattern | string | The pattern to compare against. '%' matches 0 or more characters. '' matches exactly one character. '\' can be used to escape '%', ''. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid. |
caseSensitive? | boolean | Whether to use case-sensitive comparison. Defaults to true. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
sortBy
▸ Abstract
sortBy(fieldName
, asc?
): BaseQueryBuilder
<MyDocType
>
Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them determines the order in which they are applied.
Parameters
Name | Type | Description |
---|---|---|
fieldName | keyof MyDocType & string | The name of the field to sort by. |
asc? | boolean | Whether to sort in ascending order. Defaults to true. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.
throwIfInvalidLikePattern
▸ throwIfInvalidLikePattern(pattern
): void
Parameters
Name | Type |
---|---|
pattern | string |
Returns
void
where
▸ Abstract
where(fieldName
, operator
, value
): BaseQueryBuilder
<MyDocType
>
Adds a condition to the query.
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof MyDocType & string | The name of the field to query. |
operator | Operator | "in" | "not in" | The operator to use. |
value | PrimitiveFieldType | PrimitiveFieldType [] | The value to compare against. |
Returns
BaseQueryBuilder
<MyDocType
>
The query builder.