MongoDB Discord Bot Error

I have been trying to run a discord bot, but when I try to use any commands this is the error I get
Using node16

MongoServerSelectionError: connect ECONNREFUSED
    at Timeout._onTimeout (/home/container/node_modules/mongodb/lib/core/sdam/topology.js:438:30)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  reason: TopologyDescription {
    type: 'Unknown',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: null
    this.db = this.client.db(this.dbName).collection(this.collection);

TypeError: Cannot read properties of undefined (reading 'db')
    at JoshProvider.init (/home/container/node_modules/@josh-providers/mongo/src/index.js:44:27)

Means that there is no mongod server running at the given address.

1 Like