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");
5
5
const uri =
6
6
"mongodb+srv://<clusterUrl>/?replicaSet=rs&writeConcern=majority" ;
7
7
8
- const client = new MongoClient ( uri ) ;
8
+ const client = new MongoClient ( uri , { monitorCommands : true } ) ;
9
9
10
10
// Replace <event name> with the name of the event you are subscribing to.
11
11
const eventName = "<event name>" ;
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ events created by the MongoDB deployment:
30
30
.. literalinclude:: /code-snippets/monitoring/apm-subscribe.js
31
31
:language: javascript
32
32
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
+
33
39
Event Descriptions
34
40
------------------
35
41
You can’t perform that action at this time.
0 commit comments