Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.8K
Visualizações
'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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda