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

107
Vistas
Compare existing object value from list on DB

I want firstly for each iteration to map & get all title , desc & adref value present on my jList and a second step, on the fact adref is unique string characters, i want compare each "adref" value if is already present on DB or not.

const jList = [];
var array = jList;
    
  var arrayLength = Object.keys(array).length 
    
   for(var i = 0; i <= arrayLength; i++) {
      var title = array.data[i].title;
      var desc = array.data[i].description;
      var adref = array.data[i].adref;

      const adrefExists = await ColectData.exists({ adref: adref });
      if (adrefExists === 'undefined' || adrefExists === true) console.log("adref exists");
        continue;
      else:
        console.log( "adding" + title + " " + desc + " " + adref + "on DB...");
        assignDataValue(title, desc, adref)
        continue;
    }

but i got this :

0
(node:7434) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at apiToDB (/Users/mac/Desktop/project_test/index.js:59:28)
    at /Users/mac/Desktop/project_test/index.js:78:1
    at Layer.handle [as handle_request] 
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7434) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7434) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks

about 4 years ago · Juan Pablo Isaza
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