Can't connect to database

DB_URI = mongodb+srv://
const mongoose = require('mongoose');

const connectDatabase = () => {
    mongoose.connect(process.env.DB_URI, {
        useNewUrlParser: true,
        useUnifiedTopology: true
        }).then(con => {
        console.log(`MongoDB Database connected with HOST: ${}`);
    }).catch(err => {
        console.error('MongoDB connection error:', err);

module.exports = connectDatabase

Server started on PORT: 4000 in PRODUCTION mode.
MongoDB connection error: 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:
at _handleConnectionErrors (D:\Visual Studio\Visual Studio Code\Projects\Diplomna\shop\node_modules\mongoose\lib\connection.js:851:11)
at NativeConnection.openUri (D:\Visual Studio\Visual Studio Code\Projects\Diplomna\shop\node_modules\mongoose\lib\connection.js:826:11) {
reason: TopologyDescription {
type: ‘ReplicaSetNoPrimary’,
servers: Map(3) {’ => [ServerDescription],’ => [ServerDescription],’ => [ServerDescription]
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: ‘atlas-10dpm3-shard-0’,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
code: undefined