-
Notifications
You must be signed in to change notification settings - Fork 52
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
DOCSP-32718: deleteone UE code comments #756
Conversation
There was a problem hiding this 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 */ |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Similar comment as https://github.com/mongodb/docs-node/pull/755/files#r1311686655
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Similar comment as https://github.com/mongodb/docs-node/pull/755/files#r1311690013
const client = new MongoClient(uri); | ||
|
||
async function run() { | ||
try { | ||
// Access the movies collection from the sample_mflix database. |
There was a problem hiding this comment.
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". |
There was a problem hiding this comment.
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.
// Print the result of the operation, depending on if a document was | ||
// deleted or not. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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)
* DOCSP-32718: deleteone UE code comments * CC comments * CC comments
* DOCSP-32718: deleteone UE code comments * CC comments * CC comments
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-32718
https://preview-mongodbrustagir.gatsbyjs.io/node/DOCSP-32718-deleteone-comments/usage-examples/deleteOne/