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

223
Vistas
MongoDB Ignoring Filter

Either I'm missing something or is this a possible Node.js driver issue?

const users = await User.find({ 'test.test': { $gt: 0 } }).lean();

None of my User documents contain the test object, therefore none should meet this filter's criteria. However, instead of returning no documents, it's returning all of my user documents. According to the documentation, it should only ever return all of the documents in a collection if no/empty filters are passed?

Edit: I said ignoring filter as it only seems to occur when applying nested filters on undefined properties. For instance, if I add more filter conditions that a few documents meet they'll apply *correctly. Example: User.find({ username: { $exists: true }, 'test.test': { $gt: 0 } }) returns only the user documents where username exists, however they still don't have the test object.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The issue was resolved by setting the Mongoose Schema strictQuery option to false.

https://mongoosejs.com/docs/guide.html#strictQuery

about 4 years ago · Juan Pablo Isaza 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