Skip to content

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Jan 21, 2026

Summary

  • Add UnsupportedOptionError for unsupported options in supported methods
  • Add find()/findOne() projection (2nd arg) and options (3rd arg) support
  • Add aggregate() options support (hint, maxTimeMS)
  • Add countDocuments() maxTimeMS support and option validation
  • Add estimatedDocumentCount() options support (maxTimeMS)
  • Add distinct() options support (maxTimeMS)
  • Add getCollectionInfos() options support (nameOnly, authorizedCollections)
  • Add cursor hint(), max(), min() methods

Supported Options by Method

Method Options
find() projection (2nd arg), hint, max, min, maxTimeMS
findOne() projection (2nd arg), hint, max, min, maxTimeMS
aggregate() hint, maxTimeMS
countDocuments() hint, limit, skip, maxTimeMS
estimatedDocumentCount() maxTimeMS
distinct() maxTimeMS
getCollectionInfos() nameOnly, authorizedCollections

Cursor Modifier Methods

Method Description
hint() Specify index by name (string) or spec (document)
max() Set upper bound for index scan
min() Set lower bound for index scan

Test plan

  • All new options tested with positive cases
  • UnsupportedOptionError returned for unsupported options
  • All existing tests still pass (59 tests)
  • Linter passes (0 issues)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 21, 2026 05:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request extends M1 (Milestone 1) MongoDB operations with robust options support and improved error handling for unsupported features.

Changes:

  • Introduces new error types (UnsupportedOptionError, PlannedOperationError) to distinguish between unsupported options and planned-but-unimplemented operations
  • Extends find()/findOne() to support projection as 2nd argument and options (hint, max, min, maxTimeMS) as 3rd argument
  • Adds options support to aggregate(), countDocuments(), estimatedDocumentCount(), distinct(), and getCollectionInfos() with proper validation
  • Implements cursor modifier methods: hint(), max(), min()
  • Simplifies method registry to only track planned (M2/M3) operations
  • Updates dependency to newer parser version

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
errors.go Adds UnsupportedOptionError and PlannedOperationError types; removes DeprecatedOperationError; simplifies error messages
translator.go Extends mongoOperation struct with new option fields; refactors extraction functions to handle multiple arguments and validate options; adds cursor method extractors
method_registry.go Simplified to only contain 32 planned M2/M3 methods; removes deprecated/unsupported tracking; changes registry lookup logic
executor.go Applies new options to MongoDB driver calls; adds maxTimeMS handling
executor_test.go Comprehensive tests for all new options and error cases; updates existing test expectations
go.mod/go.sum Updates parser dependency version
docs/plans/*.md Design and implementation documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@h3n4l h3n4l force-pushed the vk/bd54-gomongo-mileston branch from 5af8c86 to 0b1100b Compare January 21, 2026 06:11
Extend M1 methods to support additional arguments and commonly used options:

- Add UnsupportedOptionError type for unsupported options in supported methods
- find()/findOne(): support projection (2nd arg) and options (3rd arg)
  - Options: hint, max, min, maxTimeMS
- aggregate(): support options (2nd arg)
  - Options: hint, maxTimeMS
- countDocuments(): add maxTimeMS support and option validation
- estimatedDocumentCount(): add maxTimeMS support
- distinct(): add maxTimeMS support (3rd arg)
- getCollectionInfos(): add options support (2nd arg)
  - Options: nameOnly, authorizedCollections
- Add cursor modifier methods: hint(), max(), min()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@h3n4l h3n4l force-pushed the vk/bd54-gomongo-mileston branch from 0b1100b to 46b0df4 Compare January 21, 2026 06:37
@rebelice rebelice merged commit 7c1bc05 into main Jan 21, 2026
2 checks passed
@rebelice rebelice deleted the vk/bd54-gomongo-mileston branch January 21, 2026 06:43
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.

3 participants