Skip to content

MongoDB Deprecation warning #38

@aalfiann

Description

@aalfiann

I use mongodb 4.2.0.

here is my connection string

var Agent = require('sqlagent/mongodb').connect('mongodb://127.0.0.1:27017/database');

Then I've got info deprecated.

(node:5317) 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.
(node:5317) 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.

Then I tried to use options like this

var Agent = require('sqlagent/mongodb').connect('mongodb://127.0.0.1:27017/database', { 
    useNewUrlParser: true,
    useUnifiedTopology: true 
});

It's doesn't work because I know in sqlagent/mongodb.js, I can't adding more options.
I've seen that function connect is (conn, callback), no options in there.

So how the solution for this?

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