'Can't Connect Mongoose to MongoDB - There is no established connection with mongoose and a mongoose connection is required

I was looking around in Discord.JS and creating a bot, but every time I want to turn on the bot, ( using node index.js) this error happens:

throw new Error("There is no established connection with mongoose and a mongoose connection is required!");

and this is my source code:

const { VoiceClient } = require('djs-voice')
const client = require('../index')
const { } = require('../config.json')
const { mongo } = require('mongoose')

const voiceClient = new VoiceClient({
    allowBots: true,
    client: client,
    debug: true,
    mongooseConnectionString: mongo
})


module.exports = voiceClient;
const client = require("..")
const voiceClient = require('../Client/voiceClient')

client.on('voiceStateUpdate', (oldState, newState) => {
    voiceClient.startListener(oldState, newState);
})
{
    "token" : "********************************************************",
    "prefix": "$ sudo ",
    "mongooseConnectionString": "mongodb+srv://themadmad:********@cluster0.fntof.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"
}

btw I'm using Discord.JS and djs-voice



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source