Skip to content

feat: add comprehensive method registry for deprecated/unsupported operations#12

Merged
h3n4l merged 2 commits intomainfrom
vk/bd54-gomongo-mileston
Jan 20, 2026
Merged

feat: add comprehensive method registry for deprecated/unsupported operations#12
h3n4l merged 2 commits intomainfrom
vk/bd54-gomongo-mileston

Conversation

@h3n4l
Copy link
Member

@h3n4l h3n4l commented Jan 20, 2026

Summary

  • Add a method registry system with 297 entries covering all MongoDB shell commands from the milestone design document
  • Provide actionable error messages for deprecated methods (with alternatives) and unsupported methods (with hints)
  • Add DeprecatedOperationError type distinct from UnsupportedOperationError
  • Add MethodRegistryStats() function for tracking registry coverage

Registry Coverage

Category Count
Collection methods 48
Cursor methods 34
Database methods 51
Connection methods 16
Replication (rs.*) 14
Sharding (sh.*) 48
Encryption 17
Bulk operations 21
Plan cache 5
Stream processing (sp.*) 9
Native functions 17
Atlas Search Index 5
Total 297

Plus 14 object constructors handled separately in helper_functions.go, matching the 311 total commands in the milestone design document.

Test plan

  • go build ./... passes
  • golangci-lint run passes with 0 issues
  • go test -v ./... passes
  • TestMethodRegistryStats verifies registry counts

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 20, 2026 08:58
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 adds a comprehensive method registry system to handle MongoDB shell commands, providing actionable error messages for deprecated and unsupported operations. The registry covers 297 methods across 12 categories including collection, cursor, database, connection, replication, sharding, encryption, bulk operations, plan cache, stream processing, native functions, and Atlas Search Index operations.

Changes:

  • Added method_registry.go with a comprehensive registry of 297 MongoDB methods categorized by status (supported/deprecated/unsupported) and context
  • Introduced DeprecatedOperationError type to distinguish deprecated methods from unsupported ones
  • Refactored translator.go to use the method registry for error handling and improved argument extraction methods
  • Updated parser dependency to newer version
  • Added tests for method registry functionality and Atlas Search Index error handling
  • Updated documentation in CLAUDE.md to guide future method implementation

Reviewed changes

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

Show a summary per file
File Description
method_registry.go New file containing 297 method entries with status, context, alternatives/hints, and lookup/stats functions
translator.go Refactored argument extraction methods, added handleUnsupportedMethod function, integrated method registry for error handling
errors.go Added DeprecatedOperationError type with alternative suggestions
helper_functions.go Updated Date helper to remove 'new' keyword support per parser changes
executor_test.go Added tests for Atlas Search Index and method registry statistics
go.mod Updated parser dependency to v0.0.0-20260120080341-a57d4b68030c
go.sum Updated checksums for new parser version
CLAUDE.md Added documentation on method registry system and how to add new method support

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

…erations

Add a method registry system that provides actionable error messages for
MongoDB shell methods that are either deprecated or not yet supported.

Changes:
- Add method_registry.go with 297 method entries covering all MongoDB
  shell commands from the milestone design document
- Add DeprecatedOperationError type for deprecated methods with alternatives
- Update translator to use registry for error handling
- Update helper_functions.go for parser compatibility
- Add MethodRegistryStats() function for registry statistics
- Update CLAUDE.md with method registry documentation

The registry covers:
- Collection methods (48)
- Cursor methods (34)
- Database methods (51)
- Connection methods (16)
- Replication rs.* methods (14)
- Sharding sh.* methods (48)
- Encryption methods (17)
- Bulk operations (21)
- Plan cache methods (5)
- Stream processing sp.* methods (9)
- Native shell functions (17)
- Atlas Search Index methods (5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@h3n4l h3n4l force-pushed the vk/bd54-gomongo-mileston branch from a7aad80 to 5ac23d8 Compare January 20, 2026 09:02
| Category | Old Count | Actual Count |
|----------|-----------|--------------|
| Connection | 16 | 17 |
| Replication | 14 | 15 |
| Sharding | 52 | 49 |
| Encryption | 17 | 18 |
| Bulk | 21 | 22 |
| Plan Cache | 5 | 6 |
| Stream | 9 | 10 |
| Native | 16 | 18 |

The test confirms total is still 297 entries.
@h3n4l h3n4l requested a review from Copilot January 20, 2026 09:05
@h3n4l h3n4l enabled auto-merge (squash) January 20, 2026 09:07
@h3n4l h3n4l merged commit b70a5ff into main Jan 20, 2026
6 checks passed
@h3n4l h3n4l deleted the vk/bd54-gomongo-mileston branch January 20, 2026 09:08
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

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


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

},

// ============================================================
// CONNECTION METHODS (17) - Mongo(), connect(), connection chain
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 17 connection methods, but only 16 are defined (Mongo, connect, getDB, getDBNames, getDBs, getReadPrefMode, getReadPrefTagSet, getURI, getWriteConcern, setCausalConsistency, setReadPref, setWriteConcern, startSession, watch, Session, SessionOptions). The comment should say 16 instead of 17, or an additional connection method is missing.

Suggested change
// CONNECTION METHODS (17) - Mongo(), connect(), connection chain
// CONNECTION METHODS (16) - Mongo(), connect(), connection chain

Copilot uses AI. Check for mistakes.
Comment on lines +87 to +89
status: statusDeprecated,
context: contextCollection,
alternative: "dropIndexes()",
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The deprecation message for dropIndex is misleading. In MongoDB, dropIndex() is NOT deprecated - it's a valid method for dropping a single index. The deprecated method is actually dropIndexes() with a single index name, which should use dropIndex() instead. This entry should be removed or corrected.

Suggested change
status: statusDeprecated,
context: contextCollection,
alternative: "dropIndexes()",
status: statusSupported,
context: contextCollection,
alternative: "",

Copilot uses AI. Check for mistakes.
},

// ============================================================
// ENCRYPTION METHODS (18) - KeyVault, ClientEncryption
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 18 encryption methods, but only 17 are defined. The comment should say 17 instead of 18, or an additional encryption method is missing.

Suggested change
// ENCRYPTION METHODS (18) - KeyVault, ClientEncryption
// ENCRYPTION METHODS (17) - KeyVault, ClientEncryption

Copilot uses AI. Check for mistakes.
},

// ============================================================
// BULK OPERATION METHODS (22)
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 22 bulk operation methods, but only 21 are defined. The comment should say 21 instead of 22, or an additional bulk method is missing.

Suggested change
// BULK OPERATION METHODS (22)
// BULK OPERATION METHODS (21)

Copilot uses AI. Check for mistakes.
},

// ============================================================
// PLAN CACHE METHODS (6)
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 6 plan cache methods, but only 5 are defined. The comment should say 5 instead of 6, or an additional plan cache method is missing.

Suggested change
// PLAN CACHE METHODS (6)
// PLAN CACHE METHODS (5)

Copilot uses AI. Check for mistakes.
},

// ============================================================
// STREAM PROCESSING METHODS (10) - sp.* Atlas Stream Processing
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 10 stream processing methods, but only 9 are defined. The comment should say 9 instead of 10, or an additional stream processing method is missing.

Suggested change
// STREAM PROCESSING METHODS (10) - sp.* Atlas Stream Processing
// STREAM PROCESSING METHODS (9) - sp.* Atlas Stream Processing

Copilot uses AI. Check for mistakes.
},

// ============================================================
// NATIVE SHELL METHODS (18) - top-level functions
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 18 native shell methods, but only 17 are defined. The comment should say 17 instead of 18, or an additional native method is missing.

Suggested change
// NATIVE SHELL METHODS (18) - top-level functions
// NATIVE SHELL METHODS (17) - top-level functions

Copilot uses AI. Check for mistakes.
},

// ============================================================
// REPLICATION METHODS (15) - rs.* methods
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment claims 15 replication methods, but only 14 are defined (add, addArb, conf, freeze, help, initiate, printReplicationInfo, printSecondaryReplicationInfo, reconfig, reconfigForPSASet, remove, status, stepDown, syncFrom). The comment should say 14 instead of 15, or an additional replication method is missing.

Suggested change
// REPLICATION METHODS (15) - rs.* methods
// REPLICATION METHODS (14) - rs.* methods

Copilot uses AI. Check for mistakes.
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