MongoDB and Mongoose - Freecodecamp keeps getting timed out

solution: boilerplate-mongomongoose - Replit

Link to the challenge:

Hey yall. Hope you are doing well.My RAM usage for some reason is touching the limits making my solution link non responsive.
screen

Could someone help me? Thanks in advance.

Hello!

One problem I see is that you never call done when there’s an error, which may be causing multiple connections to be kept open:

var removeById = function(personId, done) {
  Person.findByIdAndRemove(
    personId,
    (err, removedDoc) => {
      if(err) return console.log(err); // Here you should call done(err) and, also, log the error
      done(null, removedDoc);
    }
  ); 
};
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.