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

[TASK] Standardize Mongo collection operation wrappers #596

Open
2 tasks
roberlander2 opened this issue Sep 28, 2022 · 0 comments
Open
2 tasks

[TASK] Standardize Mongo collection operation wrappers #596

roberlander2 opened this issue Sep 28, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@roberlander2
Copy link
Contributor

Description

The ReplaceOne and UpdateOne wrapper functions in collection.go do not behave the same way, which can lead to some confusion. ReplaceOne does not return mongo.UpdateResult and will return an error if no document is found to replace, but UpdateOne does return mongo.UpdateResult and will not return an error.

Also, FindOne and FindOneAndUpdate return an error that does not clearly indicate whether the requested document was found.

Acceptance Criteria

  • Return mongo.UpdateResult object and error from ReplaceOne to standardize with UpdateOne
  • Return (bool, error) from FindOne and FindOneAndUpdate to give a better indication of whether the requested document was found

@petyos, @shurwit please let me know what you think of these proposed changes. Thanks.

@roberlander2 roberlander2 added the enhancement New feature or request label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant