Package com.mongodb.embedded.client
Class MongoClientSettings
- java.lang.Object
-
- com.mongodb.embedded.client.MongoClientSettings
-
@Immutable public final class MongoClientSettings extends Object
Various settings to control the behavior of an EmbeddedMongoClient
.- Since:
- 3.8
- Since server release
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MongoClientSettings.Builder
A builder forMongoClientSettings
so thatMongoClientSettings
can be immutable, and to support easier construction through chaining.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MongoClientSettings.Builder
builder()
Convenience method to create a Builder.static MongoClientSettings.Builder
builder(MongoClientSettings settings)
Convenience method to create a from an existingMongoClientSettings
.String
getApplicationName()
Gets the logical name of the application using this MongoClient.CodecRegistry
getCodecRegistry()
The codec registry to use, or null if not set.List<CommandListener>
getCommandListeners()
Gets the list of addedCommandListener
.String
getDbPath()
Gets the dbPath for the embedded mongod.static CodecRegistry
getDefaultCodecRegistry()
Gets the default codec registry.MongoClientSettings
getWrappedMongoClientSettings()
Returns the wrapped MongoClientSettings instance
-
-
-
Method Detail
-
getDefaultCodecRegistry
public static CodecRegistry getDefaultCodecRegistry()
Gets the default codec registry. It includes the following providers:- Returns:
- the default codec registry
-
builder
public static MongoClientSettings.Builder builder()
Convenience method to create a Builder.- Returns:
- a builder
-
builder
public static MongoClientSettings.Builder builder(MongoClientSettings settings)
Convenience method to create a from an existingMongoClientSettings
.- Parameters:
settings
- create a builder from existing settings- Returns:
- a builder
-
getApplicationName
public String getApplicationName()
Gets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection.Default is null.
- Returns:
- the application name, which may be null
-
getCodecRegistry
public CodecRegistry getCodecRegistry()
The codec registry to use, or null if not set.- Returns:
- the codec registry
-
getCommandListeners
public List<CommandListener> getCommandListeners()
Gets the list of addedCommandListener
.The default is an empty list.
- Returns:
- the unmodifiable list of command listeners
-
getDbPath
public String getDbPath()
Gets the dbPath for the embedded mongod.- Returns:
- the dbPath
-
getWrappedMongoClientSettings
public MongoClientSettings getWrappedMongoClientSettings()
Returns the wrapped MongoClientSettings instance- Returns:
- the wrapped MongoClient Settings instance.
-
-