feat(mongodb): collection stats and create database on legacy agent
This commit is contained in:
1 parent
3687a9cbfb
commit
c30f6821d3
5 files changed
+126
-29
No files matched your search
@@ -376,8 +376,9 @@ describe("database namespace creation", () => {
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "duckdb" })).toBe("attach");
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "sqlite" })).toBe("attach");
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "mongodb" })).toBe("special");
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "mongodb", driver_profile: "mongodb-legacy" })).toBeNull();
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "mongodb", driver_profile: "legacy" })).toBeNull();
|
||||
// The Legacy Agent creates databases through runCommand, so it gets the same flow.
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "mongodb", driver_profile: "mongodb-legacy" })).toBe("special");
|
||||
expect(connectionNamespaceCreationTarget({ db_type: "mongodb", driver_profile: "legacy" })).toBe("special");
|
||||
});
|
||||
|
||||
it("hides persistent SQLite attachment for memory and SQLCipher connections", () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ConnectionConfig, DatabaseType, TreeNodeType } from "@/types/database";
|
||||
import { isMongoLegacyDriverProfile } from "@/lib/mongo/mongoCapabilities";
|
||||
import { connectionIsEffectivelyReadOnly } from "@/lib/database/readOnlyWriteAccess";
|
||||
|
||||
export type DatabaseNamespaceCreationTarget = "database" | "schema" | "attach" | "special";
|
||||
@@ -114,7 +113,6 @@ function namespaceCreationMatrixEntry(connection: NonNullable<CreationConnection
|
||||
|
||||
export function connectionNamespaceCreationTarget(connection: CreationConnection): ConnectionCreationTarget | null {
|
||||
if (!connection || connectionIsEffectivelyReadOnly(connection)) return null;
|
||||
if (connection.db_type === "mongodb" && isMongoLegacyDriverProfile(connection.driver_profile)) return null;
|
||||
if (connection.db_type === "sqlite" && (connection.host?.trim().toLowerCase() === ":memory:" || Boolean(connection.password))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user