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

168
Views
Buscar en MongoDB con Graphql (clave externa)

Buena tarde.

Tengo 2 colecciones en mongoDB con una relación de uno a muchos, donde una de las colecciones recibe la clave externa de la otra.

 const Sport = mongoose.model('Sport', new Schema({ _id: { type: String, default:() => uuid() }, name: { type: String, required: true } })) const Event = mongoose.model('Event', new Schema({ _id: { type: String, default:() => uuid() }, name: { type: String, required: true }, sport_id: { type: String, required: true } }))

Quiero hacer búsquedas en estas colecciones con graphql y cuando busque Evento, muestre los datos de 'sport_id' en lugar de solo mostrar la Cadena. ¿Como lo hago? ¿Cómo hago el valor raíz?

 type Sport { _id: String name: String } type Event { _id: String name: String sport_id: Sport } type Query { sport(name: String): [Sport!] sportById(_id: String): Sport event(name: String, sport_id: String): Event! eventById(_id: String): Event }
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!