@Immutable public interface MongoClient extends Closeable
Instance of this class server as factories for MongoDatabase instances.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the client, which will close all underlying cached resources, including, for example,
sockets and background monitoring threads.
|
MongoDatabase |
getDatabase(String name)
Gets the database with the given name.
|
com.mongodb.async.client.MongoClientSettings |
getSettings()
Gets the settings that this client uses to connect to server.
|
org.reactivestreams.Publisher<String> |
listDatabaseNames()
Get a list of the database names
|
ListDatabasesPublisher<org.bson.Document> |
listDatabases()
Gets the list of databases
|
<TResult> ListDatabasesPublisher<TResult> |
listDatabases(Class<TResult> clazz)
Gets the list of databases
|
MongoDatabase getDatabase(String name)
name - the name of the databasevoid close()
close in interface AutoCloseableclose in interface Closeablecom.mongodb.async.client.MongoClientSettings getSettings()
Note: MongoClientSettings is immutable.
org.reactivestreams.Publisher<String> listDatabaseNames()
ListDatabasesPublisher<org.bson.Document> listDatabases()
<TResult> ListDatabasesPublisher<TResult> listDatabases(Class<TResult> clazz)
TResult - the type of the class to use instead of Document.clazz - the class to cast the database documents to