Mongoose Fail To Connect

MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an
IP that isn’t whitelisted. Make sure your current IP address is on your Atlas cluster’s IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/

I was confronted with this error while trying to connect via mongoose.

const { Client, GatewayIntentBits } = require('discord.js');
const checkUpdates = require(`./checkUpdates.js`);
const mongoose = require(`mongoose`);
require(`dotenv`).config();

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

mongoose.connect(process.env.mongoose || '', { }).then(() => {
  console.log(`Mongoose connected`)
setTimeout(() => {
 if (client.shard.ids[0] === 0) {
    setInterval(() => { checkUpdates(client) }, 130_000);   
      }
    }, 20000);
  });


client.login(process.env.token);

When I entered the string into VSC MongoDB application is surprisingly worked, but just not with code for whatever reason. I have encountered the error once before and it was solved when I created another access user, but not this time. The network access is any IP.