public interface MongoDbFactory extends CodecRegistryProvider
DB instances.| Modifier and Type | Method and Description |
|---|---|
default org.bson.codecs.configuration.CodecRegistry |
getCodecRegistry()
Get the underlying
CodecRegistry used by the MongoDB Java driver. |
com.mongodb.client.MongoDatabase |
getDb()
Creates a default
DB instance. |
com.mongodb.client.MongoDatabase |
getDb(String dbName)
Creates a
DB instance to access the database with the given name. |
PersistenceExceptionTranslator |
getExceptionTranslator()
Exposes a shared
MongoExceptionTranslator. |
com.mongodb.DB |
getLegacyDb() |
com.mongodb.session.ClientSession |
getSession(com.mongodb.ClientSessionOptions options)
Obtain a
ClientSession for given ClientSessionOptions. |
MongoDbFactory |
withSession(com.mongodb.session.ClientSession session)
Obtain a
ClientSession bound instance of MongoDbFactory returning MongoDatabase instances
that are aware and bound to the given session. |
default MongoDbFactory |
withSession(com.mongodb.ClientSessionOptions options)
Obtain a
ClientSession bound instance of MongoDbFactory returning MongoDatabase instances
that are aware and bound to a new session with given options. |
getCodecFor, hasCodecForcom.mongodb.client.MongoDatabase getDb()
throws DataAccessException
DB instance.DataAccessExceptioncom.mongodb.client.MongoDatabase getDb(String dbName) throws DataAccessException
DB instance to access the database with the given name.dbName - must not be null or empty.DataAccessExceptionPersistenceExceptionTranslator getExceptionTranslator()
MongoExceptionTranslator.com.mongodb.DB getLegacyDb()
default org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
CodecRegistry used by the MongoDB Java driver.getCodecRegistry in interface CodecRegistryProvidercom.mongodb.session.ClientSession getSession(com.mongodb.ClientSessionOptions options)
ClientSession for given ClientSessionOptions.options - must not be null.default MongoDbFactory withSession(com.mongodb.ClientSessionOptions options)
ClientSession bound instance of MongoDbFactory returning MongoDatabase instances
that are aware and bound to a new session with given options.options - must not be null.MongoDbFactory withSession(com.mongodb.session.ClientSession session)
ClientSession bound instance of MongoDbFactory returning MongoDatabase instances
that are aware and bound to the given session.session - must not be null.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.