Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
use populate data to filter in search mongoose

Hello good evening can someone help me with this question please. I want to bring all the users by the name of the area when it exists. But the name of the area is in a populate.

I have the image but it doesn't work for me

enter image description here

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can't query by populate.

But you can implement that instead:

  1. First find Area by nombre_area
  2. And then find Users with areaI equal to that area id

It's simple and should be performant, as I believe you don't have thousands of areas.

over 4 years ago · Santiago Trujillo Denunciar

0

you have two solutions

1- separate the query and write a method & named it aeraExist(name) and filter it by name

2- in the populate add match & if that filter doesn't match it will return null

    .populate({
      path: "areaI",
      match: {name: "Us"},
    })
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda