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

145
Views
Consulta por atributo de modelo poblado

Tengo el siguiente ejemplo de datos consultado desde mongoose:

 { _id: new ObjectId("622a0cbef19bd38844b8755d"), creator: new ObjectId("61e955a77aece40e1e5b5535"), description: 'XYZ', category: { _id: new ObjectId("6226704b9410d37a7686224b"), public: true }, active: true, }

Me gustaría obtener todos los documentos donde category.public equals true

En mi controlador probé la siguiente consulta:

 const task = await Task.find({ creator: userid, active: true, }).populate({ path: 'category', model: Category, select: 'public' }) .where('category.public').equals(true) .sort({ active: 'desc', });

Pero el resultado siempre está vacío. Sé que hay algunos documentos coincidentes y si .where('category.public').equals(true) devuelve todos los registros. ¿Alguna idea de cómo consultar con un atributo poblado? Probablemente hay algo mal con mi enfoque.

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!