private List<PartialPath> collectDatabases(
      final PartialPath pathPattern,
      final PathPatternTree scope,
      final boolean isPrefixMatch,
      final boolean collectInternal)
      throws MetadataException {
    final List<PartialPath> result = new LinkedList<>();
    try (final DatabaseCollector<?, ?> collector =
        new DatabaseCollector<List<PartialPath>, IConfigMNode>(
            root, pathPattern, store, isPrefixMatch, scope) {

          @Override
          protected void collectDatabase(final IDatabaseMNode<IConfigMNode> node) {
            result.add(node.getPartialPath());
          }
        }) {
      collector.setCollectInternal(collectInternal);
      collector.traverse();
    }
    return result;
  }
Get all database that the given path pattern matches. If using prefix match, the path pattern
is used to match prefix path. All timeseries start with the matched prefix path will be
collected.

@param pathPattern a path pattern or a full path
@param scope traversing scope
@param isPrefixMatch if true, the path pattern is used to match prefix path
@return a list contains all database names under given path pattern
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java