Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
How can I find many-to-many relations in nest.js

I try to view the document of typeorm (for v0.3 now). But the Nest.js application is based on v0.2.

The document said that I can use find method with find-option:

const questions = await questionRepository.find({
    relations: {
        categories: true,
    },
})

But when I try, the TypeScript tell me that the relations' type is string[]. So I change it to:

const questions = await questionRepository.find({
    relations: ['categories']
})

But raise an error:

Relation "categories" was not found; please check if it is correct and really exists in your entity.

I do not want to use createQueryBuilder because it uses the string and it is hard to deal with: Sometimes the original entity changes its name but TypeScript will never raise an error...

So can I use the relations on v0.2? I cannot find anything useful for this version.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda