HasManyRepository is a Relation Repository used to handle HasMany relationships.
find()Find associated objects
Signature
async find(options?: FindOptions): Promise<M[]>Details
The query parameters are the same as Repository.find().
findOne()Find an associated object, returning only one record
Signature
async findOne(options?: FindOneOptions): Promise<M>count()Returns the number of records that match the query conditions
Signature
async count(options?: CountOptions)Type
findAndCount()Queries the database for a dataset and the number of results that match specific conditions.
Signature
async findAndCount(options?: FindAndCountOptions): Promise<[any[], number]>Type
create()Create associated objects
Signature
async create(options?: CreateOptions): Promise<M>update()Update associated objects that meet the conditions
Signature
async update(options?: UpdateOptions): Promise<M>destroy()Delete associated objects that meet the conditions
Signature
async destroy(options?: TK | DestroyOptions): Promise<M>add()Add object associations
Signature
async add(options: TargetKey | TargetKey[] | AssociatedOptions)Type
Details
tk - The targetKey value of the associated object, which can be a single value or an array.
remove()Remove the association with the given objects
Signature
async remove(options: TargetKey | TargetKey[] | AssociatedOptions)Details
Parameters are the same as the add() method.
set()Set the associated objects for the current relationship
Signature
async set(options: TargetKey | TargetKey[] | AssociatedOptions)Details
Parameters are the same as the add() method.