Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

286
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda