Class MongoClients
- java.lang.Object
-
- com.mongodb.reactivestreams.client.MongoClients
-
public final class MongoClients extends java.lang.Object
A factory for MongoClient instances.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MongoClient
create()
Creates a new client with the default connection string "mongodb://localhost".static MongoClient
create(com.mongodb.ConnectionString connectionString)
Create a new client with the given connection string.static MongoClient
create(com.mongodb.ConnectionString connectionString, com.mongodb.MongoDriverInformation mongoDriverInformation)
Create a new client with the given connection string.static MongoClient
create(com.mongodb.MongoClientSettings settings)
Create a new client with the given client settings.static MongoClient
create(com.mongodb.MongoClientSettings settings, com.mongodb.MongoDriverInformation mongoDriverInformation)
Creates a new client with the given client settings.static MongoClient
create(java.lang.String connectionString)
Create a new client with the given connection string.static org.bson.codecs.configuration.CodecRegistry
getDefaultCodecRegistry()
Gets the default codec registry.
-
-
-
Method Detail
-
create
public static MongoClient create()
Creates a new client with the default connection string "mongodb://localhost".- Returns:
- the client
-
create
public static MongoClient create(java.lang.String connectionString)
Create a new client with the given connection string.- Parameters:
connectionString
- the connection- Returns:
- the client
-
create
public static MongoClient create(com.mongodb.ConnectionString connectionString)
Create a new client with the given connection string.- Parameters:
connectionString
- the settings- Returns:
- the client
-
create
public static MongoClient create(com.mongodb.ConnectionString connectionString, com.mongodb.MongoDriverInformation mongoDriverInformation)
Create a new client with the given connection string.Note: Intended for driver and library authors to associate extra driver metadata with the connections.
- Parameters:
connectionString
- the settingsmongoDriverInformation
- any driver information to associate with the MongoClient- Returns:
- the client
- Since:
- 1.3
-
create
public static MongoClient create(com.mongodb.MongoClientSettings settings)
Create a new client with the given client settings.- Parameters:
settings
- the settings- Returns:
- the client
- Since:
- 1.8
-
create
public static MongoClient create(com.mongodb.MongoClientSettings settings, com.mongodb.MongoDriverInformation mongoDriverInformation)
Creates a new client with the given client settings.Note: Intended for driver and library authors to associate extra driver metadata with the connections.
- Parameters:
settings
- the settingsmongoDriverInformation
- any driver information to associate with the MongoClient- Returns:
- the client
- Since:
- 1.8
-
getDefaultCodecRegistry
public static org.bson.codecs.configuration.CodecRegistry getDefaultCodecRegistry()
Gets the default codec registry.- Returns:
- the default codec registry
- Since:
- 1.4
- See Also:
MongoClientSettings.getCodecRegistry()
-
-