Feat/mongo index edit - #6159
Open
a2468947480 wants to merge 3 commits into
Open
Conversation
Add a Navicat-style index manager panel for MongoDB collections: list, create and drop indexes. Native driver reads the full option set (sparse/TTL/partial filter/background/bucketSize/hidden) via raw listIndexes; Legacy Agent connections degrade with properties_complete=false rather than presenting defaults as truth.
# Conflicts: # apps/desktop/src/composables/__tests__/useSidebarDatabaseSpecificMutationRuntime.mongo.spec.ts # apps/desktop/src/lib/backend/tauri.ts
Reuse the create-index form in a new 'edit' mode: selecting an index and clicking Edit prefills the form with its keys and options. Saving shows a confirmation previewing the dropIndex + createIndex commands, then runs them in sequence. Protected _id indexes stay read-only.
t8y2
requested changes
Aug 13, 2026
t8y2
left a comment
Owner
There was a problem hiding this comment.
This edit path can currently lose or replace indexes without preserving their server-side semantics, so it is not safe to merge yet.
- The edit form does not round-trip all options returned by the server.
hidden, collation, text weights/default language, geo options,wildcardProjection, and otherextraOptionscan be silently dropped when the old index is deleted and recreated. - The update is a non-atomic
dropfollowed bycreatewith no recovery. A name conflict, duplicate data for a unique index, permission/version error, or network failure after the drop permanently leaves the collection without the original index. - The cached index specification is not re-read immediately before deletion. If another client recreates the same index while the dialog is open, this operation can delete the newer index.
Please preserve the complete index specification, preflight the replacement, add a safe failure/restore strategy, and re-read/compare the current server spec before destructive execution. Add regression coverage for unsupported options, create failure after drop, and concurrent replacement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明 / Summary
dropIndex+createIndex两条命令,确认后依次执行_id_默认索引不可编辑(与不可删除一致)Add an "Edit Index" action to the MongoDB index manager panel, mirroring the Navicat workflow. Selecting an existing index and clicking Edit Index prefills the create form with its keys and options (unique/sparse/TTL/partial filter/background/bucketSize). Saving shows a confirmation previewing the
dropIndex+createIndexcommands, then runs them in sequence. The protected_id_index stays read-only. The edit mode reuses the existing create form with no backend changes (drop + create reuse existing APIs).变更类型 / Type of Change
涉及前端 / Frontend Changes
本 PR 涉及前端改动,已附截图/录屏(见下方)
This PR includes frontend changes
索引管理面板工具栏新增 Edit Index 按钮(铅笔图标)
选中已有索引后点击 Edit 进入编辑模式,表单预填,保存按钮触发 drop+create 确认
新增 i18n 文案已同步适配 en / zh-CN / zh-TW 三语言
Added an Edit Index button (pencil icon) to the index manager toolbar. Selecting an index and clicking Edit enters edit mode with the form prefilled; the Save button triggers a drop+create confirmation. All new i18n strings are provided in en / zh-CN / zh-TW.
验证 / Verification
pnpm vitest run apps/desktop/src/lib/sidebar/__tests__/mongoCollectionMutation.spec.ts apps/desktop/src/composables/__tests__/useSidebarDatabaseSpecificMutationRuntime.mongo.spec.ts(57 项通过 / 57 tests passed)pnpm vitest run apps/desktop/src/components/sidebar/__tests__/SidebarTreeItemDialogs.mongoIndex.spec.ts packages/app-tests/productionGuardEntrypoints.test.ts(5 项通过 / 5 tests passed)pnpm typecheck(vue-tsc --noEmit 无错误 / no errors)pnpm dev:tauri桌面窗口手动验证:编辑索引 → drop + create → 列表刷新 → 新索引选中 / Manual verification in desktop dev window: edit index → drop + create → list refresh → new index selected关联 Issue / Related Issue
无关联 Issue,为索引管理面板的功能增强。



No related issue; this is a feature enhancement for the index manager panel.