driver-core/src/main/com/mongodb/MongoNamespace.java
public static void checkDatabaseNameValidity(final String databaseName) {
        notNull("databaseName", databaseName);
        isTrueArgument("databaseName is not empty", !databaseName.isEmpty());
        for (int i = 0; i < databaseName.length(); i++) {
            isTrueArgument("databaseName does not contain '" + databaseName.charAt(i) + "'",
                    !PROHIBITED_CHARACTERS_IN_DATABASE_NAME.contains(databaseName.charAt(i)));
        }
    }
public static void checkDatabaseNameValidity(final String databaseName) {
        notNull("databaseName", databaseName);
        isTrueArgument("databaseName is not empty", !databaseName.isEmpty());
        for (int i = 0; i < databaseName.length(); i++) {
            isTrueArgument("databaseName does not contain '" + databaseName.charAt(i) + "'",
                    !PROHIBITED_CHARACTERS_IN_DATABASE_NAME.contains(databaseName.charAt(i)));
        }
    }
Check the validity of the given database name. A valid database name is non-null, non-empty, and does not contain any of the
following characters: {@code '\0', '/', '\\', ' ', '"', '.'}. The server may impose additional restrictions on database names.

@param databaseName the database name
@throws IllegalArgumentException if the database name is invalid
@since 3.4
@mongodb.driver.manual reference/limits/#naming-restrictions Naming Restrictions