MongooseServerSelectionError: connect ECONNREFUSED

Hello, I am having trouble getting connected to my localhost MongoDB on Mac OS. I have read through countless forums and tried everything to get mongod and the mongodb-community server started, but nothing has worked. The error I am getting is below:

  const serverSelectionError = new ServerSelectionError();

MongooseServerSelectionError: connect ECONNREFUSED`

Can anyone help me with this please?

Is your mongod up and running on port 27017?
Can you connect by another tool like shell or Compass?