D
D
defany2021-02-25 20:15:13
MongoDB
defany, 2021-02-25 20:15:13

How to fix error when starting VK bot on Mongodb?

When starting the bot, this type of error pops up:

Bot was started
(node:10760) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10760) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.
D:\Programming\node_modules\mongoose\lib\helpers\promiseOrCallback.js:19
throw 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: https://docs.atlas.mongodb.com/security-whitelist/

I'm new to JS and don't know how to solve this problem.

The connection string looks like this:
mongoose.connect('mongodb+ srv://DeFaNJI :<(Password here)>@ cluster0.dz5ax.mongodb.net/VkBot?retryWrites=true&... ', { useUnifiedTopology: true } , function (err) {

if (err) throw err;

console.log('Successfully connected');

});

I must say right away that the Internet is working on the laptop and the IP address is present in the white list.

p.s. Fixed.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question