Class: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>
A query builder that can participate in a join. To learn more about join queries, see the documentation.
Type parameters
Name | Type |
---|---|
Aliases | extends Record <Alias , Alias []> |
ReturnType | extends Record <Alias , DocumentData > |
LatestAlias | extends Alias |
RootAlias | extends Alias |
Hierarchy
BaseQueryBuilder
<ReturnType
>↳
JoinQueryBuilder
Implements
SnapshotEmitter
<WithDocumentReferences
<ReturnType
>>HasGrouped
HasDereference
Methods
addCompositeCondition
▸ addCompositeCondition(conditions
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Parameters
Name | Type |
---|---|
conditions | SimpleCondition <any , string , Operator >[] |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Implementation of
SnapshotEmitter.addCompositeCondition
arrayIncludesAll
▸ arrayIncludesAll(fieldName
, values
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Adds a condition to the query to check if the specified field includes all the given values.
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
values | PrimitiveFieldType [] | The values to check for inclusion in the field array. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
BaseQueryBuilder.arrayIncludesAll
arrayIncludesSome
▸ arrayIncludesSome(fieldName
, values
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Adds a condition to the query to check if the specified field includes any of the given values.
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
values | PrimitiveFieldType [] | The values to check for inclusion in the field array. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
BaseQueryBuilder.arrayIncludesSome
arrayNotIncludes
▸ arrayNotIncludes(fieldName
, values
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Adds a condition to the query to check if the specified field does not include any of the given values.
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
values | PrimitiveFieldType [] | The values to check for non-inclusion in the field array. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
BaseQueryBuilder.arrayNotIncludes
clone
▸ clone(): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Implementation of
SnapshotEmitter.clone
dereference
▸ dereference(): DereferencedJoin
<Aliases
, ReturnType
, RootAlias
, LatestAlias
>
Dereferences the document references in the result of this query. For example, collection.query().snapshot() returns an array of DocumentReference objects, but collection.query().dereference().snapshot() returns an array of the actual document data.
Returns
DereferencedJoin
<Aliases
, ReturnType
, RootAlias
, LatestAlias
>
Implementation of
eq
▸ eq(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '==', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
extractData
▸ extractData(data
): Required
<ReturnType
>[RootAlias
]
Parameters
Name | Type |
---|---|
data | WithDocumentReferences <ReturnType > |
Returns
Required
<ReturnType
>[RootAlias
]
Implementation of
SnapshotEmitter.extractData
flipSortOrder
▸ flipSortOrder(): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Implementation of
SnapshotEmitter.flipSortOrder
getLimit
▸ getLimit(): number
Returns
number
Implementation of
SnapshotEmitter.getLimit
getSortOrders
▸ getSortOrders(): FieldSort
<any
>[]
Returns
FieldSort
<any
>[]
Implementation of
SnapshotEmitter.getSortOrders
grouped
▸ grouped(): GroupedJoin
<Aliases
, ReturnType
, RootAlias
, LatestAlias
>
Returns
GroupedJoin
<Aliases
, ReturnType
, RootAlias
, LatestAlias
>
Inherit Doc
Implementation of
HasGrouped.grouped
gt
▸ gt(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '>', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
gte
▸ gte(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '>=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
hasIsInner
▸ hasIsInner(): boolean
Returns
boolean
in
▸ in(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, 'in', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType [] | An array of values to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
join
▸ join<NewAlias
, NewReturnType
, LeftAlias
, IsInner
>(queryBuilder
, alias
, joinFields
, options
): Omit
<JoinQueryBuilder
<Omit
<Aliases
, LeftAlias
> & Record
<LeftAlias
, [...Aliases[LeftAlias][], NewAlias
]> & Record
<NewAlias
, []>, ReturnType
& IsInner
extends true
? Record
<NewAlias
, NewReturnType
> : Partial
<Record
<NewAlias
, NewReturnType
>>, NewAlias
, RootAlias
>, "limit"
| "getLimit"
>
Joins this query with another join query and return a new query builder that can be used to query the joined documents.
Type parameters
Name | Type |
---|---|
NewAlias | extends string |
NewReturnType | extends DocumentData |
LeftAlias | extends string |
IsInner | extends boolean = false |
Parameters
Name | Type | Description |
---|---|---|
queryBuilder | QueryBuilder <NewReturnType > | The query builder to join with |
alias | Exclude <NewAlias , keyof ReturnType > | TODO |
joinFields | Object | TODO |
joinFields.left | keyof Required <ReturnType >[LeftAlias ] & string | - |
joinFields.right | keyof NewReturnType & string | - |
options | Object | TODO |
options.isInner? | IsInner | - |
options.leftAlias | LeftAlias | - |
Returns
Omit
<JoinQueryBuilder
<Omit
<Aliases
, LeftAlias
> & Record
<LeftAlias
, [...Aliases[LeftAlias][], NewAlias
]> & Record
<NewAlias
, []>, ReturnType
& IsInner
extends true
? Record
<NewAlias
, NewReturnType
> : Partial
<Record
<NewAlias
, NewReturnType
>>, NewAlias
, RootAlias
>, "limit"
| "getLimit"
>
A new query builder that can be used to query the joined documents
▸ join<NewAlias
, NewReturnType
, IsInner
>(queryBuilder
, alias
, joinFields
, options?
): Omit
<JoinQueryBuilder
<Omit
<Aliases
, LatestAlias
> & Record
<LatestAlias
, [...Aliases[LatestAlias][], NewAlias
]> & Record
<NewAlias
, []>, ReturnType
& IsInner
extends true
? Record
<NewAlias
, NewReturnType
> : Partial
<Record
<NewAlias
, NewReturnType
>>, NewAlias
, RootAlias
>, "limit"
| "getLimit"
>
Type parameters
Name | Type |
---|---|
NewAlias | extends string |
NewReturnType | extends DocumentData |
IsInner | extends boolean = false |
Parameters
Name | Type |
---|---|
queryBuilder | QueryBuilder <NewReturnType > |
alias | Exclude <NewAlias , keyof ReturnType > |
joinFields | Object |
joinFields.left | keyof Required <ReturnType >[LatestAlias ] & string |
joinFields.right | keyof NewReturnType & string |
options? | Object |
options.isInner? | IsInner |
Returns
Omit
<JoinQueryBuilder
<Omit
<Aliases
, LatestAlias
> & Record
<LatestAlias
, [...Aliases[LatestAlias][], NewAlias
]> & Record
<NewAlias
, []>, ReturnType
& IsInner
extends true
? Record
<NewAlias
, NewReturnType
> : Partial
<Record
<NewAlias
, NewReturnType
>>, NewAlias
, RootAlias
>, "limit"
| "getLimit"
>
like
▸ like(fieldName
, pattern
, caseSensitive?
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, 'like', pattern).
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & 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
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
limit
▸ limit(limit
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
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 maximum number of results to return |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder
Implementation of
SnapshotEmitter.limit
Overrides
lt
▸ lt(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '<', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
lte
▸ lte(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '<=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
neq
▸ neq(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, '!=', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType | The value to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
nin
▸ nin(fieldName
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, 'not in', value)
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & string | The name of the field to query. |
value | PrimitiveFieldType [] | An array of values to compare against. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
notLike
▸ notLike(fieldName
, pattern
, caseSensitive?
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
A shortcut for where(fieldName, 'not like', pattern).
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType & 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
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder.
Inherited from
paginate
▸ paginate(options?
): Pagination
<WithDocumentReferences
<ReturnType
>>
Returns a pagination wrapper for this query.
Parameters
Name | Type | Description |
---|---|---|
options? | Partial <PaginationOptions > | The pagination options. Defaults to { subscribe: true, pageSize: 100 } . |
Returns
Pagination
<WithDocumentReferences
<ReturnType
>>
Implementation of
peek
▸ peek(): WithDocumentReferences
<ReturnType
>[]
Returns the results of the query based on the data that is currently available on the client. This method is useful for synchronously accessing data that has already been fetched by another query. The method will return an empty array if data has not yet been populated.
Returns
WithDocumentReferences
<ReturnType
>[]
An array of query results.
Implementation of
serialize
▸ serialize(): SerializedJoinQuery
Returns
Implementation of
snapshot
▸ snapshot(): Promise
<WithDocumentReferences
<ReturnType
>[]>
Returns a promise that resolves to the query results.
Returns
Promise
<WithDocumentReferences
<ReturnType
>[]>
A promise that resolves to the query results.
Implementation of
snapshots
▸ snapshots(subscribe?
): Observable
<WithDocumentReferences
<ReturnType
>[]>
Returns an observable that emits the query results and updates whenever the query results change unless
subscribe=false
is provided.
Important: Make sure to unsubscribe from the observable when you are done with it.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
subscribe | boolean | true | Whether to subscribe to changes to the query results. Defaults to true . |
Returns
Observable
<WithDocumentReferences
<ReturnType
>[]>
An observable for the query results.
Implementation of
sortBy
▸ sortBy(fieldName
, asc?
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
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 | Default value | Description |
---|---|---|---|
fieldName | string | keyof ReturnType [RootAlias ] & string | undefined | The name of the field to sort by |
asc | boolean | true | Whether to sort in ascending order. Defaults to true. |
Returns
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder
Overrides
throwIfInvalidLikePattern
▸ throwIfInvalidLikePattern(pattern
): void
Parameters
Name | Type |
---|---|
pattern | string |
Returns
void
Inherited from
BaseQueryBuilder.throwIfInvalidLikePattern
where
▸ where(fieldName
, operator
, value
): JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
Adds a condition to the query.
Parameters
Name | Type | Description |
---|---|---|
fieldName | string | keyof ReturnType [LatestAlias ] & 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
JoinQueryBuilder
<Aliases
, ReturnType
, LatestAlias
, RootAlias
>
The query builder