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

525
Views
Typeorm, MongoDB y TypeGraphQL - Rellenar - Buscar

Estoy trabajando con Typeorm y MongoDB. Tengo una entidad UserAlert que guarda el _id de otra entidad Usuario como campo. Mi pregunta es cómo puede obtener la información de la entidad a la que se refiere ese _id. Sería algo parecido a poblar en mangosta.

Ejemplo:

Usuario:

 @Entity({ name: 'Users' }) export default class User extends BaseEntity { @ObjectIdColumn() _id!: ObjectID; @Column('string') firstName!: string; @Column('string') lastName!: string; @Column('string') phoneNumber!: string; }

Alerta de usuario:

 @Entity({ name: 'UserAlerts' }) export default class UserAlert extends BaseEntity { @ObjectIdColumn() _id!: ObjectID; //REFERENCE @ObjectIdColumn() userId!: ObjectID; @Column('date') date!: Date; }

Resultado: alerta de usuario

 { "_id":"asdbfsdf32112312dasdas", "date":"15/09/2021", "User":{ "_id":"asdas6d5412634123654", "firstName":"Jorge", "lastName":"Mamani", "phoneNumber":"465465" } }

¿Cómo tendría que presentar los datos en Type GraphQL?

over 4 years ago · Santiago Trujillo
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!