Java 类com.mongodb.client.ListDatabasesIterable 实例源码

项目:jframe    文件:TestMongoClientService.java   
public void testDatabase() {
    MongoClient mongoClient = mongo.getClient("mongo1");
    ListDatabasesIterable<Document> list = mongoClient.listDatabases();
    MongoCursor<Document> iterD = list.iterator();
    while (iterD.hasNext()) {
        Document doc = iterD.next();
        System.out.println(doc);
        if (!doc.getBoolean("empty", true)) {
            System.out.println(mongoClient.getDatabase(doc
                    .getString("name")));
        }
    }

    // MongoIterable<String> mongo = mongoClient.listDatabaseNames();
    // MongoCursor<String> iter = mongo.iterator();
    // while (iter.hasNext()) {
    // System.out.println(iter.next());
    // }
}
项目:jframe    文件:TestMongoClient.java   
public void testDatabase() {
    ListDatabasesIterable<Document> list = mongoClient.listDatabases();
    MongoCursor<Document> iterD = list.iterator();
    while (iterD.hasNext()) {
        Document doc = iterD.next();
        System.out.println(doc);
        if (!doc.getBoolean("empty", true)) {
            System.out.println(mongoClient.getDatabase(doc
                    .getString("name")));
        }
    }

    // MongoIterable<String> mongo = mongoClient.listDatabaseNames();
    // MongoCursor<String> iter = mongo.iterator();
    // while (iter.hasNext()) {
    // System.out.println(iter.next());
    // }
}
项目:studio-repository-tool    文件:MongoMonitor.java   
public ListDatabasesIterable<Document> listDatabases() {
    return mongoClient.listDatabases();
}
项目:ibm-performance-monitor    文件:ProfiledMongoClient.java   
/**
 * Gets the list of databases
 *
 * @return the list of databases
 */
public ListDatabasesIterable<Document> listDatabases()
{
    return listDatabases(Document.class);
}
项目:ibm-performance-monitor    文件:ProfiledMongoClient.java   
/**
 * Gets the list of databases
 *
 * @param clazz
 *            the class to cast the database documents to
 * @param <T>
 *            the type of the class to use instead of {@code Document}.
 * @return the list of databases
 */
public <T> ListDatabasesIterable<T> listDatabases(final Class<T> clazz)
{
    return client.listDatabases(clazz);
}