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

193
Vistas
I have created an API in node js in request I am getting object but while retrieving it server side showing error

I am not getting the error that why that array is not pushing into parameter Here is my code in session.poll_questions_list.push I am trying to push array but getting an error like "Cast to ObjectID failed for value"

router.put('/session/updatepoll/:sessionID', function(req, res) {
  Session.findById(req.params.sessionID, function(err, session) {
    if (err) {
      return res.send(err);
    }
    if (session) {
      if (req.body.poll_enabled) {
        session.poll_enabled = req.body.poll_enabled;
        session.poll_type = req.body.poll_type;
        session.poll_questions_list.push(req.body.poll_questions_list);
        session.save(function(err, session) {
          if (err) {
            return res.send(err);
          } else {
            res.json(session);
          }
        })
      }
      if (!req.body.poll_enabled) {
        session.poll_enabled = req.body.poll_enabled;
        session.poll_type = "";
        session.poll_questions_list = [];
        session.save(function(err, session) {
          if (err) {
            return res.send(err);
          } else {
            res.json(session);
          }
        })
      }
    }
  })
})
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