Adds a composite condition (AND of multiple conditions) to the query.
An array of simple conditions to apply.
The updated query builder.
Adds a condition to the query to check if the specified field includes all the given values.
The name of the field to query.
The values to check for inclusion in the field array.
The query builder.
Adds a condition to the query to check if the specified field includes any of the given values.
The name of the field to query.
The values to check for inclusion in the field array.
The query builder.
Adds a condition to the query to check if the specified field does not include any of the given values.
The name of the field to query.
The values to check for non-inclusion in the field array.
The query builder.
Returns the query object built by this query builder.
Creates a deep copy of the current query builder.
A cloned instance of the query builder.
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.
A shortcut for where(fieldName, '==', value)
The name of the field to query.
The value to compare against.
The query builder.
Extracts the root document's data from a join query result.
A result object with document references.
The root alias's document reference data.
Reverses the current sort order(s) of the query.
The updated query builder with reversed sort order(s).
@internal/
Gets the list of sort orders applied to the query.
An array of field sort configurations.
Transforms this join query result to a nested data structure. For example, a join between teachers and students normally returns a result of the form: [ { teacher: {name: 'Mr. Smith'}, student: {name: 'John Doe'} }, { teacher: {name: 'Mr. Smith'}, student: {name: 'Jane Smith'} }, { teacher: {name: 'Mr. EmptyClass'}, student: undefined }, ] into a result of the form: [ { teacher: {name: 'Mr. Smith'}, students: [ { name: 'John Doe' }, { name: 'Jane Smith' }, ]}, { teacher: {name: 'Mr. EmptyClass'}, students: [] }, ]
A shortcut for where(fieldName, '>', value)
The name of the field to query.
The value to compare against.
The query builder.
A shortcut for where(fieldName, '>=', value)
The name of the field to query.
The value to compare against.
The query builder.
Checks whether the join query contains any inner joins.
true
if at least one join is inner; otherwise false
.
A shortcut for where(fieldName, 'in', value)
The name of the field to query.
An array of values to compare against.
The query builder.
Joins this query with another collection using a specified alias from the left side of the join, allowing you to build complex multi-level joins. The join is defined by specifying which fields to use on both sides of the relationship.
The query builder for the collection you want to join with.
A unique alias for the joined collection. Must not conflict with existing aliases.
The join condition specifying which fields to join: left
is from the leftAlias
collection,
right
is from the joined collection.
Configuration for the join:
leftAlias
: the alias of the collection on the left-hand side of the join.isInner
: whether this should be an inner join (default is outer join).A new JoinQueryBuilder
instance including the joined collection, allowing you to continue building the
query.
Joins this query with another collection using a specified alias from the left side.
The query builder for the collection to be joined.
A unique alias for the joined collection.
Fields that define the join relationship (left
and right
).
Optional
options: { isInner?: IsInner }Options including the left alias to join from and whether the join is inner.
A new JoinQueryBuilder
including the joined collection.
A shortcut for where(fieldName, 'like', pattern).
The name of the field to query.
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.
Optional
caseSensitive: booleanWhether to use case-sensitive comparison. Defaults to true.
The query builder.
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.
The maximum number of results to return
The query builder
A shortcut for where(fieldName, '<', value)
The name of the field to query.
The value to compare against.
The query builder.
A shortcut for where(fieldName, '<=', value)
The name of the field to query.
The value to compare against.
The query builder.
A shortcut for where(fieldName, '!=', value)
The name of the field to query.
The value to compare against.
The query builder.
A shortcut for where(fieldName, 'not in', value)
The name of the field to query.
An array of values to compare against.
The query builder.
A shortcut for where(fieldName, 'not like', pattern).
The name of the field to query.
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.
Optional
caseSensitive: booleanWhether to use case-sensitive comparison. Defaults to true.
The query builder.
Enables pagination for the join query results.
Optional
options: Partial<PaginationOptions>Optional pagination configuration such as page size and cursor.
A Pagination object for fetching paginated results.
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.
An array of query results.
Serializes the join query into a plain object.
A serialized representation of the query, suitable for transport or logging.
Returns a promise that resolves to the query results.
A promise that resolves to the query results.
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.
Whether to subscribe to changes to the query results. Defaults to true
.
An observable for the query results.
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.
The name of the field to sort by
Whether to sort in ascending order. Defaults to true.
The query builder
Adds a condition to the query.
The name of the field to query
The operator to use
The value to compare against
The query builder
A query builder that can participate in a join. To learn more about join queries, see the documentation.