小编Max*_*anh的帖子

关系中的 Typeorm OneToMany 过滤器不会影响结果

我有两个表:

@Entity('Reviews')
class Review {
  ...
  @OneToMany((type) => MapCategory, map => map.review)
  public categories: MapCategory[];
}
Run Code Online (Sandbox Code Playgroud)

和:

@Entity('MapCategories')
export class MapCategory {
  ...
  @ManyToOne(type => Review, (review) => review.categories)
  public review: Review;
}
Run Code Online (Sandbox Code Playgroud)

当我尝试过滤“类别”但结果没有过滤“类别”时,请按照我已经推送的键。

const items = await this.reviewRepository.findAndCount({
      relations: ['categories'],
      where: {
        categories: {
           id: 1
        }
      }
    });
Run Code Online (Sandbox Code Playgroud)

postgresql node.js typescript typeorm

5
推荐指数
2
解决办法
6312
查看次数

标签 统计

node.js ×1

postgresql ×1

typeorm ×1

typescript ×1