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

1.8K
Vistas
'Or' statement in mongo-db compass

enter image description here

In Mongodb compass. I want to search a collection for the word "LLC" in Both the ownerName and ownerStreet properties (I don't have a text index.) I started with :

{ownerName: {$regex: / LLC/i}}

which gives 3043 results.

However using:

{ownerName: {$regex: RegExp(' LLC')},ownerStreet: {$regex: RegExp(' LLC')}}

gives only 100

meaning this is an 'and' statement not an 'or'

How do I use an 'or' statement filter in compass?

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

0

You can use the $or operator.

db.collection.find({
  $or: [
    {
      ownerName: { $regex: RegExp(' LLC') }
    },
    {
      ownerStreet: { $regex: RegExp(' LLC') }
    }
  ]
})

You can even simplify it to

db.collection.find({
  $or: [
    {
      ownerName: / LLC/
    },
    {
      ownerStreet: / LLC/
    }
  ]
})
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