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

130
Visualizações
Is there a way to query on parts of a date in a `find` query in mongodb?

so I know I can do this with an aggregate operation, but I'm not sure if I'm missing something as I can't seem to do it with a simple find call. For example I tried:

{'CreationTime': { '$dayOfMonth': 26 }}

But that failed with: unknown operator: $dayOfMonth.

I think I can achieve this with an $in query but that feels ugly having to generate every possible date.

Is this possible with a regular find query?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Short answer: No it is not.

find() only supports (as of v5) a small subset of functions that can be applied to fields compared to aggregate(). For some years now, aggregate is the new find. Under almost all conditions there is no performance benefit to using find but for simple expressions it is clearly more compact and convenient.

And starting with v4.4, many tricky update expressions are handled easier through aggregate with the merge stage set to the same collection as the input.

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