@squidcloud/backend
    Preparing search index...

    Class QueryContext<T>

    Represents the Squid query context. Passed to methods that require query details, such as those annotated with the @secureCollection annotation.

    Type Parameters

    • T extends DocumentData = any
    Index

    Accessors

    • get collectionName(): string

      The name of the collection being queried.

      Returns string

    • get integrationId(): string

      The ID of the integration being queried.

      Returns string

    • get limit(): number

      The query limit if one exists, -1 otherwise.

      Returns number

    Methods

    • Returns true if the given document can be a result of the query. The method does not account for limit and sort order.

      Parameters

      • doc: DocumentData

      Returns boolean

    • Returns all conditions that apply to any of the specified field names. This method provides a convenient way to retrieve all conditions that involve a specific set of fields.

      Type Parameters

      • K

      Parameters

      • ...fieldNames: K[]

        The field names for which to retrieve conditions.

      Returns ContextConditions<T, K>

      An array of conditions that involve any of the specified field names.

    • Returns all conditions that apply to the specified field name. This method provides a convenient way to retrieve all conditions that involve a specific field.

      Type Parameters

      • K

      Parameters

      • fieldName: K

        The field name for which to retrieve conditions.

      Returns ContextConditions<T>

      An array of conditions that involve the specified field name.

    • Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates to a subset of the results that would be obtained by applying the parent condition. The subquery may also include additional conditions, as these only narrow the result set.

      Type Parameters

      • F
      • O extends AllOperators

      Parameters

      • fieldName: F

        The name of the field for the condition.

      • operator: O

        The operator of the condition.

      • value: null | GenericValue<T, F, O>

        The value of the condition.

      Returns boolean

      Whether the query is a subquery of the parent condition.

    • Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates to a subset of the results that would be obtained by applying the parent condition. The subquery may also include additional conditions, as these only narrow the result set.

      Parameters

      Returns boolean

      Whether the query is a subquery of the parent condition.

    • Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include additional conditions, as these only narrow the result set.

      Parameters

      Returns boolean

      Whether the query includes subquery of the parent conditions.

    • Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates to a subset of the results that obtained for the parent query, including sorts and limits.

      Parameters

      • query: Query<T>

        The query to validate.

      Returns boolean

      Whether the query is a subquery of the parent query.

    • Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the sorts parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include additional fields in its sort order, but only after the specified sorts.

      Parameters

      • sorts: PartialBy<FieldSort<T>, "asc">[]

        An array of field sorts.

      Returns boolean

      Whether the query's sorts matches the provided field sorts.

    • Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the sorts parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present in the query.

      Parameters

      • sorts: PartialBy<FieldSort<T>, "asc">[]

        An array of field sorts.

      Returns boolean

      Whether the query's sorts exactly match the provided field sorts.

    Properties

    query: Query<T>