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

200
Views
How can I return only one attribute of a typeorm relation?

This is my method to return all videos, when i make the request besides returning the video it returns the category object, but i want to return only the category name and not the whole object.

async listAll(request: Request, response: Response): Promise<Response> {
    const repo = getRepository(Video);
    const videos = await repo.find({
        relations: ['category']
    });
    return response.status(200).json(videos);
}

My video model has the fllowing structure:

    @Column()
    category_id!: string;

    @ManyToOne(() => Category)
    @JoinColumn({ name: "category_id" })
    category!: Category

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!