Skip to content

fix(mongodb): implement dropObjectStatement to support dropping collections from UI - #2582

Open
0xRahad wants to merge 2 commits into
TableProApp:mainfrom
0xRahad:fix/mongodb-ui-drop-collection
Open

fix(mongodb): implement dropObjectStatement to support dropping collections from UI#2582
0xRahad wants to merge 2 commits into
TableProApp:mainfrom
0xRahad:fix/mongodb-ui-drop-collection

Conversation

@0xRahad

@0xRahad 0xRahad commented Aug 30, 2026

Copy link
Copy Markdown

Summary of Changes

Fixes the issue where dropping a MongoDB collection from the sidebar UI failed with the error:

Invalid MongoDB syntax: Query must start with 'db.' or be a JSON command

Root Cause

Collection drop requests from the sidebar route through batchToggleDeleteTableOperationSQLBuilder.dropObjectStatementPluginDriverAdapter.dropObjectStatement. When the underlying plugin does not implement dropObjectStatement, it defaults to the generic SQL fallback (DROP <objectType> <name>). Because MongoDBPluginDriver did not implement this method, it produced raw SQL (DROP TABLE "<name>"), which was rejected by MongoShellParser.

Solution

  • Implemented dropObjectStatement in MongoDBPluginDriver to return db.<collection>.drop(), enabling proper execution through the embedded mongosh runtime.
  • Added regression test testDropTableFallbackIsRejected in MongoShellParserTests.

Verification

  • Built MongoDBDriver and the full TablePro target in Debug configuration.
  • Executed and passed all 113 tests in MongoShellParserTests and PluginDriverAdapterTableOpsTests.

Closes #2581

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88ccb8189d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plugins/MongoDBDriverPlugin/MongoDBPluginDriver.swift Outdated
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.

[Bug]: Deleting/dropping a MongoDB collection via UI fails with "Invalid MongoDB syntax"

1 participant