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

84
Views
Infinity loop to an async view serve

I am building a project with Node.js Express and MongoDB. In my NoSQL database I have a collection called reviews which has 5 documents inserted. When I load my index page I want to retrieve some documents from reviews collection.

require('./database');
const Review = require('./server/models/Review');

// Index view file
app.get('/index', async (req, res) => {
  const limitNumber = 8;
  const reviews = await Review.find({}).limit(limitNumber);
  console.log(reviews) // It retrieves the documents
  res.render('index', {"userData": null}, {reviews});
});

When I load http://localhost:3000/index page it seems that it is getting caught in a infinity loop even though I have set my function and query as async-await (which means that find query never ends?)

Note: I am using Mongoose.

Any thoughts?

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