public interface MongoDbFactory extends CodecRegistryProvider, MongoSessionProvider
MongoDatabase
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
MongoDatabase 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()
Get the legacy database entry point.
|
com.mongodb.client.ClientSession |
getSession(com.mongodb.ClientSessionOptions options)
Obtain a
ClientSession for given ClientSessionOptions. |
MongoDbFactory |
withSession(com.mongodb.client.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, hasCodecFor
com.mongodb.client.MongoDatabase getDb() throws DataAccessException
MongoDatabase
instance.DataAccessException
com.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.DataAccessException
PersistenceExceptionTranslator getExceptionTranslator()
MongoExceptionTranslator
.com.mongodb.DB getLegacyDb()
getDb()
instead.default org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
CodecRegistry
used by the MongoDB Java driver.getCodecRegistry
in interface CodecRegistryProvider
com.mongodb.client.ClientSession getSession(com.mongodb.ClientSessionOptions options)
ClientSession
for given ClientSessionOptions.getSession
in interface MongoSessionProvider
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.client.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.