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

185
Vistas
MongoDB aggregate ERROR('cant $subtract a date from a string')
  • I'm implementing a requirement to group by time and query the maximum values within each grouping, but mongoDB returns an error
db.getCollection('Power').aggregate([
     {$match:{
        iotId:"57141305840d8ea11f13",
        createdTime: {'$gte': ISODate("2020-03-11T00:00:00Z")  ,'$lt':ISODate("2021-03-12T00:00:00Z")}
    }},
    {$group: {
        _id: {
            $subtract: [
                { $subtract: [ "$createdTime", new Date("1970-01-01") ] },
                { $mod: [
                    { $subtract: [ "$createdTime", new Date("1970-01-01") ] },
                    1000 * 60 * 5 
                ]}
            ]
        },
        Power: {'$max': '$Power'},
        timelist: { '$push': '$createdTime'} 
  }},
    {$project: {
            timelist: 1
    }}
]
)
over 4 years ago · Santiago Trujillo
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