diff --git a/docs/many-to-many-relations.md b/docs/many-to-many-relations.md index 1ade4bd27b..e066fd1b75 100644 --- a/docs/many-to-many-relations.md +++ b/docs/many-to-many-relations.md @@ -186,7 +186,10 @@ export class PostToCategory { @PrimaryGeneratedColumn() public postToCategoryId!: number; + @Column() public postId!: number; + + @Column() public categoryId!: number; @Column() @@ -203,6 +206,13 @@ export class PostToCategory { Additionally you will have to add a relationship like the following to `Post` and `Category`: ```typescript +// category.ts +... +@OneToMany((type) => PostToCategory, (postToCategory) => postToCategory.category) +public postToCategories!: PostToCategory[]; + +// post.ts +... @OneToMany((type) => PostToCategory, (postToCategory) => postToCategory.post) public postToCategories!: PostToCategory[]; ```