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

263
Views
API lento: rápido en MongoDb pero cuando está en API es mucho más lento, tal vez debido a RegExp

He notado que mi API es lenta. Volver a restaurantes cuando se busca en ciudades es de alrededor de 4 segundos en promedio (incluso si solo hay 10 resultados). La misma búsqueda (sin RegExp), directa en Mongo Atlas es una décima de segundo. Aquí está mi código javascript. Estoy usando Express, Mongoose y RegExp en mi js. ¿Hay alguna forma de acelerar esto, por favor? :

 // Route to return all restaurants matching the searched name, returning all fields, using a collection that has collation// app.route("/restaurants/:restaurantName") .get(function(req, res) { let partialToMatch = new RegExp(req.params.restaurantName, 'i'); Restaurant.find({ BusinessName: partialToMatch }, null, { limit: 25 }, function(err, foundRestaurant) { if (foundRestaurant) { res.send(foundRestaurant) } else { res.send("No restaurants matching that title was found."); } }); });
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!