I Have two entities:
@Entity()
export class Point {
@PrimaryGeneratedColumn('uuid')
id: string;
// some other stuff
}
@Entity()
export class Product {
@PrimaryGeneratedColumn('uuid')
id: string;
@IsOptional()
@ManyToMany(() => Point)
@JoinTable()
prohibitedToSaleOn: Point[];
}
I want to get products, where any object from prohibitedToSaleOn (array of Point's) fulfills the condition
point.id != {idWhatIWant}
So, in final I want to get all product, not banned from sales in selected point. I do something like this:
return this.productRepository.createQueryBuilder('product')
.leftJoin('product.prohibitedToSaleOn', 'point')
.where('point.id != :id', {id})
.getMany();
But it doesn't work (it should not at all)
I need help with the right request. Thanks =)
P.S. I use PostgreSQL