Skip to content

DeprecationWarning: current Server Discovery and Monitoring engine is deprecated #161

@odin16

Description

@odin16

Hello I am working with a mongo connection but I get the following warning:

DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

The solution is to add the new option but I'm not sure where, so it is possible in any of the following places:

  1. /lib/databases/mongodb.js
  • line: 91
  var defaultOpt = {
    ssl: false,
    useUnifiedTopology: true, //  <--- Option 1 for remove warning
  };
  1. /lib/databases/mongodb.js
  • line: 98
 if (isNew) {
    defaultOpt.autoReconnect = false;
    defaultOpt.useNewUrlParser = true;
    defaultOpt.useUnifiedTopology = true; //  <--- Option 2 for remove warning
    _.defaults(options.options, defaultOpt);
  } else {
    defaultOpt.auto_reconnect = false;
    _.defaults(options.options, defaultOpt);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions