title: How to select with conditions in relation in TypeORM?
body: <p>I want to find row in Friendship, where friendship.friends have users with ids equals to given. How can i do it via Repository and QueryBuilder?</p>
  <p>Entities:</p>
  <pre><code>import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from &quot;typeorm&quot;;
  import { UserToFriendship } from &quot;./userToFriendship.entity&quot;;
  
  @Entity()
  export class Friendship {
  
      @PrimaryGeneratedColumn()
      id: number
  
      @OneToMany(() =&gt; UserToFriendship, u =&gt; u.friendship, {
          eager: true
      })
      friends: UserToFriendship[]
  
      @Column({ default: false })
      accepted: boolean
  
  }
  
  
  
  import { User } from &quot;src/users/entities/user.entity&quot;;
  import { Entity, ManyToOne, PrimaryGeneratedColumn } from &quot;typeorm&quot;;
  import { Friendship } from &quot;./friendship.entity&quot;;
  
  @Entity()
  export class UserToFriendship {
  
      @PrimaryGeneratedColumn()
      id: number;
  
      @ManyToOne(() =&gt; User, user =&gt; user.friendships)
      user: User;
  
      @ManyToOne(() =&gt; Friendship, friendship =&gt; friendship.friends)
      friendship: Friendship;
  
  }
  </code></pre>