Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(mongodb): skip sync system collection (#4011)
h3n4l42eed4534136
diff --git a/plugin/db/mongodb/sync.go b/plugin/db/mongodb/sync.goindex c728af895c..34c0975b77 100644--- a/plugin/db/mongodb/sync.go+++ b/plugin/db/mongodb/sync.go@@ -12,6 +12,14 @@ import (storepb "github.com/bytebase/bytebase/proto/generated-go/store")+var systemCollection = map[string]bool{+ "system.namespaces": true,+ "system.indexes": true,+ "system.profile": true,+ "system.js": true,+ "system.views": true,+}+// UsersInfo is the subset of the mongodb command result of "usersInfo".type UsersInfo struct {Users []User `bson:"users"`@@ -90,6 +98,9 @@ func (driver *Driver) syncAllCollectionSchema(ctx context.Context, databaseName}var tableList []db.Tablefor _, collectionName := range collectionList {+ if systemCollection[collectionName] {+ continue+ }table, err := driver.syncCollectionSchema(ctx, databaseName, collectionName)if err != nil {return nil, err