#Problem with connecting to MongoDB

2 messages · Page 1 of 1 (latest)

grand ermine
require('dotenv').config();
const { Client, IntentsBitField } = require('discord.js');
const mongoose = require('mongoose')
const eventHandler = require('./handlers/eventHandler');

const client = new Client({
  intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMembers,
    IntentsBitField.Flags.GuildMessages,
    IntentsBitField.Flags.MessageContent,
  ],
});

(async () => {
  try {
    mongoose.set('strictQuery', false)
    await mongoose.connect(process.env.MONGODB_URL, { keepAlive: true })
  console.log("Connected to Database")
  } catch (error) {
    console.log(`${error}`)
  }
})

eventHandler(client);


client.login(process.env.TOKEN);```

Is there anything wrong?
wintry harnessBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!