Is it possible to do inner join with ON and IN constraints?

Viewed 32

post and tags have ManyToMany relationship. In typeorm, this is perfectry valid:

  await this.postsRepo.find({
    take: limit,
    skip: limit * pageNumber,
    join: {
        alias: 'post',
        innerJoinAndSelect: {
            tags: 'post.tags',
        },
    },
});

While I want to also be able to filter post.tag by ids, something like this:

await this.postsRepo.find({
    take: limit,
    skip: limit * pageNumber,
    join: {
        alias: 'post',
        innerJoinAndSelect: {
            tags: {
                alias: 'post.tags',
                on: {
                    'post.tags': In([validTagIds])
                }
            }
        },
    },

});

But I do not want to use the selectQueryBuilder. Is it possible by using the .find function?

0 Answers
Related