@squidcloud/client
    Preparing search index...

    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

    Hierarchy (View Summary)

    Implements

    Index

    Methods

    • Adds a composite condition (AND of multiple conditions) to the query.

      Parameters

      • conditions: SimpleCondition<
            any,
            string,
            | "in"
            | "not in"
            | "array_includes_some"
            | "array_includes_all"
            | "array_not_includes"
            | "=="
            | "!="
            | ">="
            | "<="
            | ">"
            | "<"
            | "like"
            | "not like"
            | "like_cs"
            | "not like_cs",
        >[]

        An array of simple conditions to apply.

      Returns JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>

      The updated query builder.

    • Adds a condition to the query to check if the specified field includes all the given values.

      Parameters

      • 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 this

      The query builder.

    • Adds a condition to the query to check if the specified field includes any of the given values.

      Parameters

      • 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 this

      The query builder.

    • Adds a condition to the query to check if the specified field does not include any of the given values.

      Parameters

      • 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 this

      The query builder.

    • @internal/

      Returns number

    • Gets the list of sort orders applied to the query.

      Returns FieldSort<any>[]

      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: [] }, ]

      Returns GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>

    • Checks whether the join query contains any inner joins.

      Returns boolean

      true if at least one join is inner; otherwise false.

    • A shortcut for where(fieldName, 'like', pattern).

      Parameters

      • 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.

      • OptionalcaseSensitive: boolean

        Whether to use case-sensitive comparison. Defaults to true.

      Returns this

      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.

      Parameters

      • limit: number

        The maximum number of results to return

      Returns this

      The query builder

    • A shortcut for where(fieldName, 'not like', pattern).

      Parameters

      • 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.

      • OptionalcaseSensitive: boolean

        Whether to use case-sensitive comparison. Defaults to true.

      Returns this

      The query builder.

    • 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.

    • 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

      • 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.

    • 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

      • fieldName: string | keyof ReturnType[RootAlias] & string

        The name of the field to sort by

      • asc: boolean = true

        Whether to sort in ascending order. Defaults to true.

      Returns this

      The query builder

    • Adds a condition to the query.

      Parameters

      • fieldName: string | keyof ReturnType[LatestAlias] & string

        The name of the field to query

      • operator:
            | "in"
            | "not in"
            | "array_includes_some"
            | "array_includes_all"
            | "array_not_includes"
            | "=="
            | "!="
            | ">="
            | "<="
            | ">"
            | "<"
            | "like"
            | "not like"
            | "like_cs"
            | "not like_cs"

        The operator to use

      • value: PrimitiveFieldType | PrimitiveFieldType[]

        The value to compare against

      Returns this

      The query builder