driver-legacy/src/main/com/mongodb/Mongo.java
@Deprecated
    public List<String> getDatabaseNames() {
        return new MongoIterableImpl<DBObject>(null, createOperationExecutor(), ReadConcern.DEFAULT, primary(),
                options.getRetryReads()) {
            @Override
            public ReadOperation<BatchCursor<DBObject>> asReadOperation() {
                return new ListDatabasesOperation<DBObject>(MongoClient.getCommandCodec());
            }
        }.map(new Function<DBObject, String>() {
            @Override
            public String apply(final DBObject result) {
                return (String) result.get("name");
            }
        }).into(new ArrayList<String>());
    }
@Deprecated
    public List<String> getDatabaseNames() {
        return new MongoIterableImpl<DBObject>(null, createOperationExecutor(), ReadConcern.DEFAULT, primary(),
                options.getRetryReads()) {
            @Override
            public ReadOperation<BatchCursor<DBObject>> asReadOperation() {
                return new ListDatabasesOperation<DBObject>(MongoClient.getCommandCodec());
            }
        }.map(new Function<DBObject, String>() {
            @Override
            public String apply(final DBObject result) {
                return (String) result.get("name");
            }
        }).into(new ArrayList<String>());
    }
Gets a list of the names of all databases on the connected server.

@return list of database names
@throws MongoException  if the operation fails
@deprecated Replaced with {@link com.mongodb.MongoClient#listDatabaseNames()}