Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
public class MongoSession
{
private static final Logger log = Logger.get(MongoSession.class);
private static final List<String> SYSTEM_TABLES = Arrays.asList("system.indexes", "system.users", "system.version");
private static final Set<String> SYSTEM_DATABASES = Set.of("admin", "local", "config");
private static final List<String> SYSTEM_TABLES = Arrays.asList("system.indexes", "system.users", "system.version", "system.views");

private static final String TABLE_NAME_KEY = "table";
private static final String COMMENT_KEY = "comment";
Expand Down Expand Up @@ -187,7 +188,10 @@ public List<HostAddress> getAddresses()

public List<String> getAllSchemas()
{
return ImmutableList.copyOf(listDatabaseNames().map(name -> name.toLowerCase(ENGLISH)));
return Streams.stream(listDatabaseNames())
.filter(schema -> !SYSTEM_DATABASES.contains(schema))
.map(schema -> schema.toLowerCase(ENGLISH))
.collect(toImmutableList());
}

public void createSchema(String schemaName)
Expand Down Expand Up @@ -865,6 +869,9 @@ private String toRemoteSchemaName(String schemaName)
if (!caseInsensitiveNameMatching) {
return schemaName;
}
if (SYSTEM_DATABASES.contains(schemaName)) {
return schemaName;
}
for (String remoteSchemaName : listDatabaseNames()) {
if (schemaName.equals(remoteSchemaName.toLowerCase(ENGLISH))) {
return remoteSchemaName;
Expand Down
Loading