find
methods accept special options you can use to query data you need without using QueryBuilder
:select
- indicates which properties of the main object must be selectedrelations
- relations needs to be loaded with the main entity. Sub-relations can also be loaded (shorthand for join
and leftJoinAndSelect
)join
- joins needs to be performed for the entity. Extended version of "relations".where
- simple conditions by which entity should be queried.order
- selection order.withDeleted
- include entities which have been soft deleted with softDelete
or softRemove
, e.g. have their @DeleteDateColumn
column set. By default, soft deleted entities are not included.find
methods which return multiple entities (find
, findAndCount
, findByIds
) also accept following options:skip
- offset (paginated) from where entities should be taken.take
- limit (paginated) - max number of entities that should be taken.skip
and take
should be used togethertake
or limit
, you need to use order as well or you will receive the following error: 'Invalid usage of the option NEXT in the FETCH statement.'
lock
- Enables locking mechanism for query. Can be used only in findOne
method. lock
is an object which can be defined as:LockNotSupportedOnGivenDriverError
error will be thrown.undefined
is passed as an argument, find will return all items in the table, and findOne will return the first item in the table.Not
LessThan
LessThanOrEqual
MoreThan
MoreThanOrEqual
Equal
Like
ILike
Between
In
Any
IsNull
Raw
Raw
function to provide a list of parameters to bind to the query.Not
operator: