Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!