Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DatabaseQuery<T>

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

classSchema

classSchema: ClassSchema<T>

Protected fetcher

fetcher: (mode: QueryMode, query: DatabaseQuery<T>) => Promise<any>

Type declaration

format

format: "class" | "json" | "raw" = "class"

model

model: DatabaseQueryModel<T> = new DatabaseQueryModel<T>()
internal

Protected modifier

modifier: (mode: QueryMode, query: DatabaseQuery<T>, arg1?: any) => Promise<any>

Type declaration

Methods

asJSON

  • Disable data conversion from mongodb value types to class types, and uses JSON representation instead.

    Returns DatabaseQuery<T>

asRaw

  • Disable data conversion from mongodb value types to class types, and keeps raw mongo data types instead.

    Returns DatabaseQuery<T>

clone

  • Creates a copy of DatabaseQuery from current state.

    Returns DatabaseQuery<T>

count

  • count(): Promise<number>
  • Returns Promise<number>

deleteMany

  • deleteMany(): Promise<void>
  • Returns Promise<void>

deleteOne

  • deleteOne(): Promise<void>
  • Returns Promise<void>

disableInstancePooling

  • disableInstancePooling(): this
  • Instace pooling is used to store all created entity instances in a pool. If a query fetches an already known entity instance, the old will be picked. This ensures object instances uniqueness and generally saves CPU circles.

    This disabled entity tracking, forcing always to create new entity instances.

    Returns this

filter

  • Parameters

    Returns this

find

  • find(): Promise<T[]>
  • Returns Promise<T[]>

findField

  • findField(fieldName: keyof T | string): Promise<any[]>
  • Parameters

    • fieldName: keyof T | string

    Returns Promise<any[]>

findOne

  • findOne(): Promise<T>
  • Returns Promise<T>

findOneField

  • findOneField(fieldName: keyof T | string): Promise<any>
  • Parameters

    • fieldName: keyof T | string

    Returns Promise<any>

findOneFieldOrUndefined

  • findOneFieldOrUndefined(fieldName: keyof T | string): Promise<any | undefined>
  • Parameters

    • fieldName: keyof T | string

    Returns Promise<any | undefined>

findOneOrUndefined

  • findOneOrUndefined(): Promise<T | undefined>
  • Returns Promise<T | undefined>

getJoin

has

  • has(): Promise<boolean>
  • Returns Promise<boolean>

ids

  • ids(): Promise<any[]>
  • Returns Promise<any[]>

innerJoin

  • innerJoin<K>(field: K): this
  • Adds a inner join in the filter. Does NOT populate the reference with values. Accessing field in the entity (if not optional field) results in an error.

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns this

innerJoinWith

  • innerJoinWith<K>(field: K): this
  • Adds a inner join in the filter and populates the result set WITH reference field accordingly.

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns this

join

  • join<K>(field: K, type?: "left" | "inner", populate?: boolean): this
  • Adds a left join in the filter. Does NOT populate the reference with values. Accessing field in the entity (if not optional field) results in an error.

    Type parameters

    • K: keyof T

    Parameters

    • field: K
    • Default value type: "left" | "inner" = "left"
    • Default value populate: boolean = false

    Returns this

joinWith

  • joinWith<K>(field: K): this
  • Adds a left join in the filter and populates the result set WITH reference field accordingly.

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns this

limit

  • limit(value?: undefined | number): this
  • Parameters

    • Optional value: undefined | number

    Returns this

parameter

  • parameter(name: string, value: any): this
  • Parameters

    • name: string
    • value: any

    Returns this

parameters

  • parameters(parameters: {}): this
  • Parameters

    • parameters: {}
      • [name: string]: any

    Returns this

patchMany

  • Parameters

    Returns Promise<void>

patchOne

  • Parameters

    Returns Promise<void>

select

  • select(...fields: keyof T[]): this
  • select(fields: string[] | keyof T[]): this
  • Parameters

    • Rest ...fields: keyof T[]

    Returns this

  • Parameters

    • fields: string[] | keyof T[]

    Returns this

skip

  • skip(value?: undefined | number): this
  • Parameters

    • Optional value: undefined | number

    Returns this

sort

  • sort(sort?: SORT<T>): this
  • Parameters

    • Optional sort: SORT<T>

    Returns this

updateOne

  • updateOne(item: T): Promise<void>
  • Parameters

    • item: T

    Returns Promise<void>

useInnerJoin

  • Adds a inner join in the filter. Does NOT populate the reference with values. Accessing field in the entity (if not optional field) results in an error. Returns JoinDatabaseQuery to further specify the join, which you need to .end()

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns JoinDatabaseQuery<FlattenIfArray<T[K]>, this>

useInnerJoinWith

  • Adds a inner join in the filter and populates the result set WITH reference field accordingly. Returns JoinDatabaseQuery to further specify the join, which you need to .end()

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns JoinDatabaseQuery<FlattenIfArray<T[K]>, this>

useJoin

  • Adds a left join in the filter. Does NOT populate the reference with values. Accessing field in the entity (if not optional field) results in an error. Returns JoinDatabaseQuery to further specify the join, which you need to .end()

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns JoinDatabaseQuery<FlattenIfArray<T[K]>, this>

useJoinWith

  • Adds a left join in the filter and populates the result set WITH reference field accordingly. Returns JoinDatabaseQuery to further specify the join, which you need to .end()

    Type parameters

    • K: keyof T

    Parameters

    • field: K

    Returns JoinDatabaseQuery<FlattenIfArray<T[K]>, this>

Generated using TypeDoc