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

106
Vistas
Execute conditions (Filters) one by one in MongoDB query

I'm working on a query where i'm using $and to use multiple filters or conditions. when i explain the query so i found that $and is not working like javaScript && operator. How can i achieve JavaScript && like functionality in mongoDB query?

MyModel.aggregate([{
  $match: {
    $and: [{
      $text: {
        $search: mappedSearchTxt
      }
    }, ...regexFilter, ...filters]
  }
}])
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Example document

{ 
  _id: '1234'
  name: 'John',
  age: 34,
  father: 'Andy'
}

Your $and query should look like - $and: [{ .... }]

.find({ $and: [{ name: 'John'}, { father: 'Andy' }])

The above is just a demostration of $and, because the following query works the same.

.find({ name: 'John', father: 'Andy' })
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