public class SimpleMongoClientDbFactory extends MongoDbFactorySupport<com.mongodb.client.MongoClient> implements DisposableBean
MongoDatabase instances from a MongoClient instance.| Constructor and Description |
|---|
SimpleMongoClientDbFactory(com.mongodb.ConnectionString connectionString)
Creates a new
SimpleMongoClientDbFactory instance from the given MongoClient. |
SimpleMongoClientDbFactory(com.mongodb.client.MongoClient mongoClient,
String databaseName)
Creates a new
SimpleMongoClientDbFactory instance from the given MongoClient. |
SimpleMongoClientDbFactory(String connectionString)
Creates a new
SimpleMongoClientDbFactory instance for the given connectionString. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeClient()
Close the client instance.
|
protected com.mongodb.client.MongoDatabase |
doGetMongoDatabase(String dbName)
Get the actual
MongoDatabase from the client. |
com.mongodb.DB |
getLegacyDb()
Get the legacy database entry point.
|
com.mongodb.client.ClientSession |
getSession(com.mongodb.ClientSessionOptions options)
Obtain a
ClientSession for given ClientSessionOptions. |
destroy, getDb, getDb, getDefaultDatabaseName, getExceptionTranslator, getMongoClient, setWriteConcern, withSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroygetCodecRegistry, isTransactionActive, withSessiongetCodecFor, hasCodecForpublic SimpleMongoClientDbFactory(String connectionString)
SimpleMongoClientDbFactory instance for the given connectionString.connectionString - connection coordinates for a database connection. Must contain a database name and must not
be null or empty.public SimpleMongoClientDbFactory(com.mongodb.ConnectionString connectionString)
SimpleMongoClientDbFactory instance from the given MongoClient.connectionString - connection coordinates for a database connection. Must contain also a database name and not
be null.public SimpleMongoClientDbFactory(com.mongodb.client.MongoClient mongoClient,
String databaseName)
SimpleMongoClientDbFactory instance from the given MongoClient.mongoClient - must not be null.databaseName - must not be null or empty.public com.mongodb.DB getLegacyDb()
MongoDbFactoryMongoDbFactory.getDb() instead.getLegacyDb in interface MongoDbFactorypublic com.mongodb.client.ClientSession getSession(com.mongodb.ClientSessionOptions options)
MongoDbFactoryClientSession for given ClientSessionOptions.getSession in interface MongoDbFactorygetSession in interface MongoSessionProvideroptions - must not be null.protected void closeClient()
MongoDbFactorySupportcloseClient in class MongoDbFactorySupport<com.mongodb.client.MongoClient>protected com.mongodb.client.MongoDatabase doGetMongoDatabase(String dbName)
MongoDbFactorySupportMongoDatabase from the client.doGetMongoDatabase in class MongoDbFactorySupport<com.mongodb.client.MongoClient>dbName - must not be null or empty.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.