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

136
Vistas
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 Respuestas
Responde la pregunta

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 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