Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/code-snippets/monitoring/apm-subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ const client = new MongoClient(uri, { monitorCommands:true });
// Replace <event name> with the name of the event you are subscribing to
const eventName = "<event name>";

// Subscribe to a specified event and print a message when the event is received
// Subscribes to a specified event and print a message when the event is received
client.on(eventName, event => console.log(event));

async function run() {
try {
// Establish and verify connection to the "admin" database
// Establishes and verifies connection to the "admin" database
await client.db("admin").command({ ping: 1 });
console.log("Connected successfully");
} finally {
// Close the database connection on completion or error
// Closes the database connection on completion or error
await client.close();
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/code-snippets/monitoring/cpm-subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const client = new MongoClient(uri);
// Replace <event name> with the name of the event you are subscribing to
const eventName = "<event name>";

// Subscribe to the event
// Subscribes to the event
client.on(eventName, (event) =>
console.log("\nreceived event:\n", event)
);

async function run() {
try {
// Establish and verify connection
// Establishes and verifies connection
await client.db("admin").command({ ping: 1 });
console.log("\nConnected successfully!\n");
} finally {
Expand Down
6 changes: 3 additions & 3 deletions source/code-snippets/monitoring/sdam-subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ const client = new MongoClient(uri);
// Replace <event name> with the name of the event you are subscribing to
const eventName = "<event name>";

// Subscribe to a specified event and print a message when the event is received
// Subscribes to a specified event and prints a message when the event is received
client.on(eventName, event => {
console.log(`received ${eventName}: ${JSON.stringify(event, null, 2)}`);
});

async function run() {
try {
// Establish and verify connection to the database
// Establishes and verifies connection to the database
await client.db("admin").command({ ping: 1 });
console.log("Connected successfully");
} finally {
// Close the database connection on completion or error
// Closes the database connection on completion or error
await client.close();
}
}
Expand Down
1 change: 0 additions & 1 deletion source/fundamentals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Fundamentals
Indexes </fundamentals/indexes>
Collations </fundamentals/collations>
Logging </fundamentals/logging>
Monitoring </fundamentals/monitoring>
GridFS </fundamentals/gridfs>
Time Series </fundamentals/time-series>
TypeScript </fundamentals/typescript>
Expand Down
Loading
Loading