File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const { MongoClient } = require("mongodb");
55const uri =
66 "mongodb+srv://<clusterUrl>/?replicaSet=rs&writeConcern=majority" ;
77
8- const client = new MongoClient ( uri ) ;
8+ const client = new MongoClient ( uri , { monitorCommands : true } ) ;
99
1010// Replace <event name> with the name of the event you are subscribing to.
1111const eventName = "<event name>" ;
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ events created by the MongoDB deployment:
3030.. literalinclude:: /code-snippets/monitoring/apm-subscribe.js
3131 :language: javascript
3232
33+ .. note::
34+
35+ Command monitoring is disabled by default. To enable command
36+ monitoring, pass the ``monitorCommands`` option as ``true`` to
37+ your ``MongoClient`` constructor.
38+
3339Event Descriptions
3440------------------
3541
You can’t perform that action at this time.
0 commit comments