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

Adding Update code #2

Merged
merged 3 commits into from
Nov 28, 2019
Merged

Adding Update code #2

merged 3 commits into from
Nov 28, 2019

Conversation

MaBeuLux88
Copy link
Contributor

No description provided.

@MaBeuLux88 MaBeuLux88 self-assigned this Nov 21, 2019
Copy link

@rozza rozza left a comment

Choose a reason for hiding this comment

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

One minor comment about type choices.

updateOperation = push("comments", "You will learn a lot if you read the MongoDB blog!");
UpdateOptions options = new UpdateOptions().upsert(true);
updateResult = gradesCollection.updateOne(filter, updateOperation, options);
System.out.println("\n=> Upsert document with {\"student_id\":10002.0, \"class_id\": 10.0} because it doesn't exist yet.");
Copy link

Choose a reason for hiding this comment

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

Why doubles not ints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I should use doubles everywhere then to avoid the distraction with the type equivalence when doing the queries?

Copy link

Choose a reason for hiding this comment

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

I'm happy either way - just wanted to flag it.

updateOperation = push("comments", "You will learn a lot if you read the MongoDB blog!");
UpdateOptions options = new UpdateOptions().upsert(true);
updateResult = gradesCollection.updateOne(filter, updateOperation, options);
System.out.println("\n=> Upsert document with {\"student_id\":10002.0, \"class_id\": 10.0} because it doesn't exist yet.");
Copy link

Choose a reason for hiding this comment

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

I'm happy either way - just wanted to flag it.

@MaBeuLux88 MaBeuLux88 merged commit 25cffe6 into master Nov 28, 2019
@MaBeuLux88 MaBeuLux88 deleted the update branch November 28, 2019 21:34
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