getNonSystemDatabaseList returns the list of non system databases.
(ctx context.Context)
| 293 | |
| 294 | // getNonSystemDatabaseList returns the list of non system databases. |
| 295 | func (d *Driver) getNonSystemDatabaseList(ctx context.Context) ([]string, error) { |
| 296 | databaseNames, err := d.client.ListDatabaseNames(ctx, bson.M{}) |
| 297 | if err != nil { |
| 298 | return nil, errors.Wrap(err, "failed to list database names") |
| 299 | } |
| 300 | var nonSystemDatabaseList []string |
| 301 | for _, databaseName := range databaseNames { |
| 302 | if _, ok := systemDatabase[databaseName]; !ok { |
| 303 | nonSystemDatabaseList = append(nonSystemDatabaseList, databaseName) |
| 304 | } |
| 305 | } |
| 306 | return nonSystemDatabaseList, nil |
| 307 | } |
| 308 | |
| 309 | // isAtlasUnauthorizedError returns true if the error is an Atlas unauthorized error. |
| 310 | func isAtlasUnauthorizedError(err error) bool { |
no outgoing calls
no test coverage detected