SocketException: Error connecting to 127.0.0.1:27017

Hello, I’ve been trying run mongo through brew for a few days now, but I keep getting these error messages:

❯ mongo
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1

every time I try running the brew services list, my mongodb-community status is “error”. Not sure how this can be fixed, please help!

Is your mongod up and running on port 27017?

Is the (greater than symbol>) your os prompt or are you already connected to mongo prompt and trying mongo command again?