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

147
Views
grupo mongoDB por documento anidado con ruta desconocida

quiero agrupar por valor y mi problema es screen_size y screen_resulation se puede cambiar

¿Hay algo como comodín en el documento anidado en mongodb?

he intentado esto pero no funciona

 [ { filters: { screen_size: { name: "حجم الشاشة", value: "50", }, screen_resulation: { name: "دقة الشاشة", value: "4k", }, }, }, { filters: { screen_resulation: { name: "دقة الشاشة", value: "UHD", }, screen_size: { name: "حجم الشاشة", value: "55", }, }, }, { filters: { screen_resulation: { name: "دقة الشاشة", value: "4k", }, screen_size: { name: "حجم الشاشة", value: "55", }, }, }, ]; { $group : { _id: "$filters.*.value", counter: { $sum: 1 } } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

También puede obtener el resultado deseado con el siguiente enfoque:

 [{$project: { _id: '$_id', filters: { $objectToArray: '$filters' } }}, {$unwind: { path: '$filters' }}, {$group: { _id: '$filters.v.value', count: {$sum: 1} }}]
over 4 years ago · Santiago Trujillo Report
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!