Skip to content

feat(database): add aggregate capability - #19

Merged
KilianBoute merged 1 commit into
mainfrom
feat/aggregate
Aug 13, 2026
Merged

KilianBoute merged 1 commit into
mainfrom
feat/aggregate

Conversation

@KilianBoute

@KilianBoute KilianBoute commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Description

Adds aggregation pipeline support as an optional database capability, enabling consumers to execute MongoDB aggregate queries through the shared database abstraction without coupling application code directly to the MongoDB driver.

This change improves the flexibility of the database layer by introducing a dedicated Aggregator interface that cleanly extends existing capabilities while keeping pipeline construction and decoding under consumer control. Both the real MongoDB client and the mock database now support aggregation, ensuring feature parity between production and test environments.

The mock implementation includes:

  • aggregation call tracking
  • queued and expected aggregate responses
  • option propagation
  • reset support for test isolation

Comprehensive tests were added to validate aggregate option filtering, result handling, error propagation, and mock behavior. This makes aggregation-based features easier to test reliably while preserving the lightweight and composable design of the current database package.

Add an optional Aggregator interface with MongoDB option forwarding and complete MockDatabase response, queue, call-tracking, reset, and test support.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.37838% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/database/mock.go 85.18% 4 Missing ⚠️
pkg/database/mongodb.go 60.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@KilianBoute
KilianBoute merged commit b2cf5cb into main Aug 13, 2026
6 checks passed
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