feat(mongodb): add Compass-style collection import/export

This commit is contained in:
onenewcode authored and GitHub committed 2026-09-12 21:59:29 +08:00
1 parent bf4874906c
commit 8ff56b4837
47 files changed
+5626 -52

No files matched your search

@@ -10,6 +10,7 @@ function setup(node: Partial<TreeNode>, options: { treeNodes?: TreeNode[]; selec
docsSource: null as unknown,
diagramSource: null as unknown,
databaseExportSource: null as unknown,
mongoImportSource: undefined as unknown,
schemaDiffSource: null as unknown,
treeNodes: options.treeNodes ?? [],
selectedTreeNodeIds: options.selectedTreeNodeIds ?? [],
@@ -109,6 +110,25 @@ describe("useSidebarTreeToolRuntime diagram and database export", () => {
});
});
describe("useSidebarTreeToolRuntime mongo import", () => {
it("opens collection import from a mongo-collection node", () => {
const { connectionStore, runtime } = setup({
type: "mongo-collection",
label: "orders",
connectionId: "conn-1",
database: "shop",
});
runtime.openMongoImport();
expect(connectionStore.mongoImportSource).toEqual({
connectionId: "conn-1",
database: "shop",
collection: "orders",
});
});
});
describe("useSidebarTreeToolRuntime openSchemaDiffForRoutine", () => {
it("prefills schema diff with a signature-aware routine key", () => {
const { connectionStore, runtime } = setup({