Skip to content

DOCSP-32718: deleteone UE code comments #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 31, 2023

Conversation

rustagir
Copy link
Collaborator

Copy link
Contributor

@ccho-mongodb ccho-mongodb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One style issue and a few suggestions.

@@ -1,26 +1,37 @@
/* Delete a document */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

For single-line comments, prefer "//".

@@ -1,26 +1,37 @@
/* Delete a document */

// Import the MongoClient type from the mongodb package.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { MongoClient } from "mongodb";

// Replace the uri string with your MongoDB deployment's connection string.
const uri = "<connection string uri>";

// Create a new client and connect to MongoDB.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const client = new MongoClient(uri);

async function run() {
try {
// Access the movies collection from the sample_mflix database.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
Similar comment as #754 (comment)

const database = client.db("sample_mflix");
const movies = database.collection("movies");

// Query for a movie that has title "Annie Hall"
// Create a filter for movies with a title that is "Annie Hall".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
I think it would be good to omit this since it is self-explanatory.
This comment also uses the term "filter" which doesn't match the term used earlier in the content "query document". I think it would be better to match the terminology used in the content.

Applies to all instances.

Comment on lines 24 to 25
// Print the result of the operation, depending on if a document was
// deleted or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue:

From the style guide entry "if":

Use if to introduce an adverbial clause that describes a condition on which an action depends.

Suggestion:
"// Print a message that indicates whether the operation deleted a document."

await client.close();
}
}
// Run the program and handle any errors that occur during execution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
Similar comment as #754 (comment)

@rustagir rustagir merged commit a7c4340 into mongodb:master Aug 31, 2023
rustagir added a commit that referenced this pull request Sep 7, 2023
* DOCSP-32718: deleteone UE code comments

* CC comments

* CC comments
mongoKart pushed a commit to mongoKart/docs-node that referenced this pull request Nov 3, 2023
* DOCSP-32718: deleteone UE code comments

* CC comments

* CC comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants