Skip to main content
Version: Next

FindOptions <Entity, Hint, Fields, Excludes>

Hierarchy

Index

Properties

optionalafter

after?: string | FilterObject<Entity> | { endCursor: null | string }

Fetch items after this cursor.

optionalbefore

before?: string | FilterObject<Entity> | { startCursor: null | string }

Fetch items before this cursor.

optionalcache

cache?: number | boolean | [string, number]

Control result caching for this query. Result cache is by default disabled, not to be confused with the identity map.

optionalcomments

comments?: string | string[]

sql only

optionalconnectionType

connectionType?: ConnectionType

optionalconvertCustomTypes

convertCustomTypes?: boolean

optionalctx

ctx?: any

optionaldisableIdentityMap

disableIdentityMap?: boolean

optionalinheritedexclude

exclude?: readonly AutoPath<Entity, Excludes, never, 9>[]

optionalinheritedfields

fields?: readonly AutoPath<Entity, Fields, *, 9>[]

optionalfilters

filters?: FilterOptions

optionalfirst

first?: number

Fetch first N items.

optionalflags

flags?: QueryFlag[]

optionalflushMode

flushMode?: always | FlushMode | commit | auto

optionalgroupBy

groupBy?: string | string[]

sql only

optionalhaving

having?: QBFilterQuery<Entity>

optionalhintComments

hintComments?: string | string[]

sql only

optionalindexHint

indexHint?: string

sql only

optionallast

last?: number

Fetch last N items.

optionallimit

limit?: number

Limit the number of returned results. If you try to use limit/offset on a query that joins a to-many relation, pagination mechanism will be triggered, resulting in a subquery condition, to apply this limit only to the root entities instead of the cartesian product you get from a database in this case.

optionallockMode

lockMode?: NONE | PESSIMISTIC_READ | PESSIMISTIC_WRITE | PESSIMISTIC_PARTIAL_WRITE | PESSIMISTIC_WRITE_OR_FAIL | PESSIMISTIC_PARTIAL_READ | PESSIMISTIC_READ_OR_FAIL

sql only

optionallockTableAliases

lockTableAliases?: string[]

sql only

optionalloggerContext

loggerContext?: LogContext

optionallogging

logging?: LoggingOptions

optionaloffset

offset?: number

Sets the offset. If you try to use limit/offset on a query that joins a to-many relation, pagination mechanism will be triggered, resulting in a subquery condition, to apply this limit only to the root entities instead of the cartesian product you get from a database in this case.

optionalorderBy

orderBy?: OrderDefinition<Entity>

Ordering of the results.Can be an object or array of objects, keys are property names, values are ordering (asc/desc)

optionaloverfetch

overfetch?: boolean

Fetch one more item than first/last, enabled automatically in em.findByCursor to check if there is a next page.

optionalinheritedpopulate

populate?: Populate<Entity, Hint>

optionalpopulateFilter

populateFilter?: ObjectQuery<Entity>

Filter condition for populated relations. This is similar to populateWhere, but will produce a left join when nesting the condition. This is used for implementation of joined filters.

optionalpopulateOrderBy

populateOrderBy?: OrderDefinition<Entity>

Used for ordering of the populate queries. If not specified, the value of options.orderBy is used.

optionalpopulateWhere

populateWhere?: PopulateHint | infer | all | ObjectQuery<Entity>

Where condition for populated relations. This will have no effect on the root entity. With select-in strategy, this is applied only to the populate queries. With joined strategy, those are applied as join on conditions. When you use a nested condition on a to-many relation, it will produce a nested inner join, discarding the collection items based on the child condition.

optionalrefresh

refresh?: boolean

optionalschema

schema?: string

optionalstrategy

strategy?: LoadStrategy | select-in | joined

sql only