此版本的文档已存档,不再提供支持。 查看最新文档,了解如何升级您的 Node.js 驱动程序版本。
重要
临时替代方案
我们正在开发一个新日志框架。同时,您可以使用以下代码段输出监控事件:
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));