Docs Menu

Docs HomeNode.js


On this page

  • Temporary Alternative


The driver doesn't use the logger in versions 4.0 and later. Attempting to use prior logger settings in this version won't print anything in the log.

Instead, see our monitoring guides:

The Node.js team is currently working on rewriting the logger. In the meantime, you can output monitor events using the following snippet:

const uri = "mongodb+srv://<user>:<password>@<cluster-url>?writeConcern=majority";
const client = new MongoClient(uri, { monitorCommands:true });
client.on('commandStarted', (event) => console.debug(event));
client.on('commandSucceeded', (event) => console.debug(event));
client.on('commandFailed', (event) => console.debug(event));
←  CollationsMonitoring →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.