Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
En el navegador que se muestra vacío al obtener datos de mongodb y enviarlos a mi archivo getdata.ejs

Mi método de obtención de archivo index.js

 app.get('/getdata', function(req, res){ var resultArray = []; mongo.connect(url, function(err, db){ assert.equal(null, err); var cursor = db.collection('satyamsoft').find(); cursor.forEach(function(doc, err){ assert.equal(null, err); resultArray.push(doc); console.log(resultArray); }); }); res.render('pages/getdata', {holedata: resultArray}); });

Mi archivo getdata.ejs

 <h2> Family Details </h2> <ul> <% holedata.forEach(function(data) { %> <li><%= data.name %> - <%= data.title %> - <%= data.age %></li> <% }); %> </ul>

Después de ejecutar el método de obtención en la consola que muestra los datos que se obtienen de los datos de mongodb Colnose

Pero en la página web que se muestra vacía , ingrese la descripción de la imagen aquí

Estoy haciendo algo mal. Por favor, ayúdame. Adelanto gracias.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esto podría ayudar en el lado del cliente en su archivo .ejs -

 <script> var holedata = <%- JSON.stringify(holedata) %>; </script>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!