Skip to content

feat(database): add update-many capability - #20

Merged
KilianBoute merged 1 commit into
mainfrom
feat/update-many
Aug 13, 2026
Merged

KilianBoute merged 1 commit into
mainfrom
feat/update-many

Conversation

@KilianBoute

@KilianBoute KilianBoute commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Description

This change adds first-class support for multi-document updates through a new MultiUpdater capability and UpdateMany implementation for both the MongoDB client and the testing mocks.

The main motivation is to support bulk update workflows without forcing consumers to loop over individual UpdateOne calls. Exposing UpdateMany directly improves efficiency, aligns the abstraction layer with MongoDB’s native capabilities, and simplifies application code that needs to modify multiple matching documents atomically.

The PR also improves consistency across the database package:

  • MongoClient now supports UpdateMany using the same option handling as UpdateOne.
  • Shared updateOptions logic removes duplicated option parsing and ensures both update paths behave identically.
  • MockDatabase now fully supports UpdateMany, including queued responses, call tracking, expectations, and reset handling, making integration and unit tests easier to write and more reliable.

Comprehensive tests were added to verify option filtering, result propagation, error handling, and mock state management.

Add an optional MultiUpdater interface with MongoDB UpdateMany support, shared update option filtering, and complete MockDatabase responses, queues, call tracking, reset support, and tests.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.85246% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/database/mock.go 75.00% 11 Missing and 1 partial ⚠️
pkg/database/mongodb.go 46.15% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@KilianBoute
KilianBoute merged commit d181642 into main Aug 13, 2026
6 checks passed
@KilianBoute
KilianBoute deleted the feat/update-many branch August 13, 2026 14:52
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.

1 participant