public class MongoClientImpl extends Object implements MongoClient
| Constructor and Description |
|---|
MongoClientImpl(Client client)
Create a new MongoClient.
|
MongoClientImpl(MongoClientConfiguration config)
Create a new MongoClient.
|
| Modifier and Type | Method and Description |
|---|---|
MongoClient |
asSerializedClient()
Returns a MongoClient instance that shares connections with this
MongoClient instance but serializes all of its requests on a single
connection.
|
void |
close() |
Client |
getClient()
Returns the client value.
|
MongoClientConfiguration |
getConfig()
Returns the configuration being used by the logical MongoDB connection.
|
MongoDatabase |
getDatabase(String name)
Returns the MongoDatabase with the specified name.
|
List<String> |
listDatabaseNames()
Returns a list of database names.
|
List<String> |
listDatabases()
Returns a list of database names.
|
public MongoClientImpl(Client client)
client - The client interface for interacting with the database.public MongoClientImpl(MongoClientConfiguration config)
config - The configuration for interacting with MongoDB.public MongoClient asSerializedClient()
While the returned MongoClient instance is thread safe it is intended to be used by a single logical thread to ensure requests issued to the MongoDB server are guaranteed to be processed in the same order they are requested.
Creation of the serial instance is lightweight with minimal object allocation and no server interaction.
Overridden to create a new Mongo instance around a SerialClientImpl.
asSerializedClient in interface MongoClientpublic void close()
Overridden to close the underlying client.
close in interface Closeableclose in interface AutoCloseablepublic Client getClient()
public MongoClientConfiguration getConfig()
Overridden to return the clients configuration.
getConfig in interface MongoClientpublic MongoDatabase getDatabase(String name)
Overridden to create the named database.
getDatabase in interface MongoClientname - The name of the existing database.MongoDatabase.MongoClient.getDatabase(java.lang.String)public List<String> listDatabaseNames()
Overridden to issue a listDatabases command against the 'admin' database.
listDatabaseNames in interface MongoClientMongoClient.listDatabaseNames()public List<String> listDatabases()
listDatabases in interface MongoClientCopyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.