[TASK] Standardize Mongo collection operation wrappers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start in collection.go with the ReplaceOne, UpdateOne, FindOne, and FindOneAndUpdate wrappers, then inspect their callers and existing tests to understand the current return-value expectations. Update the affected interfaces consistently and verify that callers handle the new results and that the acceptance criteria are covered by the test suite.
Written by the indexing model from the issue text.
Description
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.UpdateResultobject anderrorfromReplaceOneto standardize withUpdateOne - Return
(bool, error)fromFindOneandFindOneAndUpdateto 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.
- Dominant language
- Go
- Stars
- 3
- Forks
- 2
- Avg merge
- 5h 45m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rokwire/core-building-block
-
rokwire/core-building-block#835 · 1 assignee ·
-
enhancement
rokwire/core-building-block#789 · 1 comment · 2 assignees ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
rokwire/core-building-block#777 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 25/100
rokwire/core-building-block#776 ·
-
[BUG] Deleting user account does not delete associated profile and privacy objects for this account Openbug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
rokwire/core-building-block#751 ·
All issues in rokwire/core-building-block
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100