Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: disable backup for mongodb (#4050)

h3n4l73529dbdd5fd
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vue
index 416e4d2665..78ab2b7205 100644
--- a/frontend/src/components/DatabaseBackupPanel.vue
+++ b/frontend/src/components/DatabaseBackupPanel.vue
@@ -115,6 +115,7 @@
v-if="allowEdit"
type="button"
class="btn-normal whitespace-nowrap items-center"
+ :disabled="database.instance.engine === 'MONGODB'"
@click.prevent="state.showCreateBackupModal = true"
>
{{ $t("database.backup-now") }}
diff --git a/server/database.go b/server/database.go
index 24c5b46901..d3c1ddae7e 100644
--- a/server/database.go
+++ b/server/database.go
@@ -15,6 +15,7 @@ import (
"github.com/bytebase/bytebase/api"
"github.com/bytebase/bytebase/common"
"github.com/bytebase/bytebase/common/log"
+ "github.com/bytebase/bytebase/plugin/db"
"github.com/bytebase/bytebase/plugin/parser"
"github.com/bytebase/bytebase/plugin/parser/edit"
"github.com/bytebase/bytebase/server/component/activity"
@@ -311,6 +312,10 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Database not found with ID %d", id))
}
+ if database.Instance.Engine == db.MongoDB {
+ return echo.NewHTTPError(http.StatusBadRequest, "Backup is not supported for MongoDB")
+ }
+
storeBackupList, err := s.store.FindBackup(ctx, &api.BackupFind{
DatabaseID: &id,
Name: &backupCreate.Name,