B
B
bleach_thresh2021-08-16 15:49:46
MongoDB
bleach_thresh, 2021-08-16 15:49:46

Why won't it let me connect to the localhost?

I installed mongodb on the vds itself (Ubuntu 20), when checking the status it shows the asset.

Connecting via code

MongoClient.connect("mongodb://localhost:21017/", {
    useNewUrlParser: true,
    authSource: "admin",
    useUnifiedTopology: true
  }, function (err, database) {
    if (err) {
      console.error('An error occurred connecting to MongoDB: ', err);
    } else {
      db = database.db("bot");
    }
  });


Gives errors
An error occurred connecting to MongoDB:  MongoInvalidArgumentError: No AuthProvider for DEFAULT defined.


Handle polling update error: TypeError: Cannot read property 'collection' of undefined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-08-16
@karabanov

Enable Access Control

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question