I am using macOS Big Sur, I have installed mongodb comunity edition using this link https://docs.mongodb.com/v5.0/tutorial/install-mongodb-on-os-x
. I am able to connect to mongodb using compass but when i try to connect through my node application it gives the bellow error.
MongoServerSelectionError: connect ECONNREFUSED ::1:27017
at Timeout._onTimeout (/Users/ankurs/Desktop/workspace/ecommerce/backend/node_modules/mongodb/src/sdam/topology.ts:610:30)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
}
}