RelationRepository is a Repository object for association types. RelationRepository allows operating on associated data without loading the association. Based on RelationRepository, each association type has a corresponding derived implementation:
HasOneRepositoryHasManyRepositoryBelongsToRepositoryBelongsToManyRepositorySignature
constructor(sourceCollection: Collection, association: string, sourceKeyValue: string | number)Parameters
| Parameter Name | Type | Default Value | Description |
|---|---|---|---|
sourceCollection | Collection | - | The Collection corresponding to the referencing relation in the association |
association | string | - | Association name |
sourceKeyValue | string | number | - | The corresponding key value in the referencing relation |
db: DatabaseDatabase object
sourceCollectionThe Collection corresponding to the referencing relation in the association
targetCollectionThe Collection corresponding to the referenced relation in the association
associationThe association object in sequelize corresponding to the current association
associationFieldThe field in the collection corresponding to the current association
sourceKeyValueThe corresponding key value in the referencing relation