Skip to content
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

[C#] CodeWhisperer Code Comments - Part 4 #154

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

rachel-mack
Copy link
Collaborator

@rachel-mack rachel-mack commented Jan 4, 2024

@rachel-mack rachel-mack marked this pull request as ready for review January 5, 2024 20:23
Copy link
Collaborator

@norareidy norareidy left a comment

Choose a reason for hiding this comment

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

LGTM with suggestions, but let me know if you want me to take another look!

Comment on lines 50 to 51
// Creates a an update document that indicates that the "cuisine" field is
// changing and it's new value will be "Pasta and breadsticks"
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: based on the Java comments; I think this wording is a little clearer

Suggested change
// Creates a an update document that indicates that the "cuisine" field is
// changing and it's new value will be "Pasta and breadsticks"
// Creates instructions to update the "cuisine" field of documents that match the filter

Comment on lines 55 to 56
// Finds all the documents that matches the filter and updates the "cuisine"
// value of each by using the update document
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: also based on the Java sheet

Suggested change
// Finds all the documents that matches the filter and updates the "cuisine"
// value of each by using the update document
// Updates documents that have a "cuisine" value of "Pizza"

Comment on lines +71 to +75
// Allows automapping of the camelCase database fields to models
var camelCaseConvention = new ConventionPack { new CamelCaseElementNameConvention() };
ConventionRegistry.Register("CamelCase", camelCaseConvention, type => true);

// Establish the connection to MongoDB and get the restaurants database
// Establishes the connection to MongoDB and accesses the "sample_restaurants" collection
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: I don't think you need to include comments for these setup classes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Applies to the other setup classes too

Comment on lines 50 to 56
// Creates a an update document that indicates that the "cuisine" field is
// changing and it's new value will be "Pasta and breadsticks"
var update = Builders<Restaurant>.Update
.Set(restaurant => restaurant.Cuisine, newValue);

// Finds all the documents that matches the filter and updates the "cuisine"
// value of each by using the update document
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: suggestions that I left on UpdateMany.cs also apply here

Comment on lines 36 to 37
// Creates a an update document that indicates that the "name" field is
// changing and it's new value will be "2 Bagels 2 Buns"
Copy link
Collaborator

Choose a reason for hiding this comment

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

S:

Suggested change
// Creates a an update document that indicates that the "name" field is
// changing and it's new value will be "2 Bagels 2 Buns"
// Creates instructions to update the "name" field of the first document that matches the filter

Comment on lines 41 to 42
// Finds the first document that matches the filter and updates the "name"
// value by using the update document
Copy link
Collaborator

Choose a reason for hiding this comment

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

S:

Suggested change
// Finds the first document that matches the filter and updates the "name"
// value by using the update document
// Updates the first document that has a "name" value of "Bagels N Buns"

Comment on lines 32 to 42
// Creates a filter for all documents with a "name" of "Bagels N Buns"
var filter = Builders<Restaurant>.Filter
.Eq(restaurant => restaurant.Name, oldValue);

// Creates a an update document that indicates that the "name" field is
// changing and it's new value will be "2 Bagels 2 Buns"
var update = Builders<Restaurant>.Update
.Set(restaurant => restaurant.Name, newValue);

// Finds the first document that matches the filter and updates the "name"
// value by using the update document
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: same comments in UpdateOne.cs apply here

@rachel-mack rachel-mack merged commit 33aa7d8 into mongodb:master Jan 8, 2024
2 checks passed
@rachel-mack rachel-mack deleted the DOCSP-34178-p4 branch January 8, 2024 18:33
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