Welcome to weivData.query function of weiv-data library. This feature/function allows you to run queries on your database collections data. You can use features such as sort and filter. And you can control the query. Read documentation and learn more about weivData.query.

// Here is a quick example from our internal systems where we can get all Clusters that has more than 18K cpu score in Istanbul:

import weivData from '@exweiv/weiv-data';

const result = await weivData.query('ExWeiv/Clusters').eq('location', 'Istanbul').gt('cpuScores', 18000).find();
console.log(result);
interface WeivDataQuery<CItem> {
    and(query: WeivDataQuery<CItem>): WeivDataQuery<CItem>;
    ascending(...propertyName: Extract<keyof CItem, string>[]): WeivDataQuery<CItem>;
    between<K>(propertyName: K, rangeStart: CItem[K], rangeEnd: CItem[K]): WeivDataQuery<CItem>;
    contains(propertyName: Extract<keyof CItem, string>, string: string): WeivDataQuery<CItem>;
    count(options?: WeivDataOptions): Promise<number>;
    descending(...propertyName: Extract<keyof CItem, string>[]): WeivDataQuery<CItem>;
    distinct<K>(propertyName: K, options?: WeivDataOptions): Promise<WeivDataQueryResult<CItem[K]>>;
    endsWith(propertyName: Extract<keyof CItem, string>, string: string): WeivDataQuery<CItem>;
    eq<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    fields<K>(...propertyName: K[]): WeivDataQuery<Pick<CItem, K>>;
    find(options?: WeivDataOptionsQuery): Promise<WeivDataQueryResult<CItem>>;
    ge<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    gt<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    hasAll<K>(propertyName: K, value: CItem[K][]): WeivDataQuery<CItem>;
    hasSome<K>(propertyName: K, value: CItem[K][]): WeivDataQuery<CItem>;
    include<NewCItem>(...includes: IncludeObject[]): WeivDataQuery<CItem & NewCItem>;
    isEmpty(propertyName: Extract<keyof CItem, string>): WeivDataQuery<CItem>;
    isNotEmpty(propertyName: Extract<keyof CItem, string>): WeivDataQuery<CItem>;
    le<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    limit(limit: number): WeivDataQuery<CItem>;
    lt<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    ne<K>(propertyName: K, value: CItem[K]): WeivDataQuery<CItem>;
    not(query: WeivDataQuery<CItem>): WeivDataQuery<CItem>;
    or(query: WeivDataQuery<CItem>): WeivDataQuery<CItem>;
    skip(skip: number): WeivDataQuery<CItem>;
    startsWith(propertyName: Extract<keyof CItem, string>, string: string): WeivDataQuery<CItem>;
}

Type Parameters

  • CItem

Methods

  • Parameters

    • Rest...propertyName: Extract<keyof CItem, string>[]

      The properties used in the sort.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Adds a sort to a query or sort, sorting by the specified properties in ascending order.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with rangeStart and rangeEnd.

    • rangeStart: CItem[K]

      The beginning value of the range to match against.

    • rangeEnd: CItem[K]

      The ending value of the range to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value is within a specified range.

  • Parameters

    • propertyName: Extract<keyof CItem, string>

      The property whose value will be compared with the string.

    • string: string

      The string to look for inside the specified property value.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value contains a specified string.

  • Parameters

    • Optionaloptions: WeivDataOptions

      An object containing options to use when processing this operation.

    Returns Promise<number>

    Fulfilled - The number of items that match the query. Rejected - The errors that caused the rejection.

    Returns the number of items that match the query.

  • Parameters

    • Rest...propertyName: Extract<keyof CItem, string>[]

      The properties used in the sort.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Adds a sort to a query or sort, sorting by the specified properties in descending order.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared for distinct values.

    • Optionaloptions: WeivDataOptions

      An object containing options to use when processing this operation.

    Returns Promise<WeivDataQueryResult<CItem[K]>>

    Fulfilled - A Promise that resolves to the results of the query. Rejected - Error that caused the query to fail.

    Returns the distinct values that match the query, without duplicates.

  • Parameters

    • propertyName: Extract<keyof CItem, string>

      The property whose value will be compared with the string.

    • string: string

      The string to look for at the end of the specified property value.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value ends with a specified string.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value equals the specified value.

  • Type Parameters

    • K extends string

    Parameters

    • Rest...propertyName: K[]

      Properties to return. To return multiple properties, pass properties as additional arguments.

    Returns WeivDataQuery<Pick<CItem, K>>

    A WeivDataQuery cursor representing the refined filters.

    Lists the fields to return in a query's results.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value is greater than or equal to the specified value.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value is greater than the specified value.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K][]

      The values to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property values equals all of the specified value parameters.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K][]

      The values to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value equals any of the specified value parameters.

  • Parameters

    • propertyName: Extract<keyof CItem, string>

      The the property in which to check for a value.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property does not exist or does not have any value.

  • Parameters

    • propertyName: Extract<keyof CItem, string>

      The property in which to check for a value.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property has any value.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value is less than or equal to the specified value.

  • Parameters

    • limit: number

      The number of items to return, which is also the pageSize of the results object.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Limits the number of items the query returns.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value is less than the specified value.

  • Type Parameters

    • K extends string

    Parameters

    • propertyName: K

      The property whose value will be compared with value.

    • value: CItem[K]

      The value to match against.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value does not equal the specified value.

  • Parameters

    • skip: number

      The number of items to skip in the query results before returning the results.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Sets the number of items to skip before returning query results.

  • Parameters

    • propertyName: Extract<keyof CItem, string>

      The property whose value will be compared with the string.

    • string: string

      The string to look for at the beginning of the specified property value.

    Returns WeivDataQuery<CItem>

    A WeivDataQuery cursor representing the refined filters.

    Refines a query or filter to match items whose specified property value starts with a specified string.