Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for useUnifiedTopology #170

Open
ben4d85 opened this issue Apr 1, 2020 · 3 comments
Open

Option for useUnifiedTopology #170

ben4d85 opened this issue Apr 1, 2020 · 3 comments
Assignees

Comments

@ben4d85
Copy link

ben4d85 commented Apr 1, 2020

When using winston-mongodb, I receive the following message in the console:

(node:580) 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 following code solves the issue. However, I was wondering if you would consider adding useUnifiedTopology: true to the default options?

    loggerApp.add(
        new transports.MongoDB({ 
            db: mongoURI,
            options: { useUnifiedTopology: true, }
        }
    ));
@yurijmikhalevich yurijmikhalevich self-assigned this Apr 1, 2020
@helloalexdodd
Copy link

Ran into the same issue. Thank-you @ben4d85 for the solution! At the very least instructions to fix this should be documented somewhere, but agreed that it should be set to a default option.

@leodinas-hao
Copy link

The useUnifiedTopology set will impact on the default autoReconnect option. Please find the doc here.

After adding useUnifiedTopology, my question comes: will removing autoReconnect impact logging in any way?

@jrebmann
Copy link

After enabling the useUnifiedTopology option, I observed a strange behavior. All my unit tests went wrong.

This was because I sent 8 log messages in my unit test, but after executing a logger.end() only one was written to the database.

As soon as I deactivate the option useUnifiedTopology again, everything runs as desired again.

Can someone help me there? I cannot explain this to myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants