Package com.mongodb.client
Class MongoClients
- java.lang.Object
-
- com.mongodb.client.MongoClients
-
@Deprecated(since="2021-05-27") public final class MongoClients extends java.lang.Object
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.A factory forMongoClient
instances. Use of this class is now the recommended way to connect to MongoDB via the Java driver.- Since:
- 3.7
- See Also:
MongoClient
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MongoClient
create()
Deprecated.Creates a new client with the default connection string "mongodb://localhost".static MongoClient
create(ConnectionString connectionString)
Deprecated.Create a new client with the given connection string.static MongoClient
create(ConnectionString connectionString, MongoDriverInformation mongoDriverInformation)
Deprecated.Create a new client with the given connection string.static MongoClient
create(MongoClientSettings settings)
Deprecated.Create a new client with the given client settings.static MongoClient
create(MongoClientSettings settings, MongoDriverInformation mongoDriverInformation)
Deprecated.Creates a new client with the given client settings.static MongoClient
create(java.lang.String connectionString)
Deprecated.Create a new client with the given connection string as if by a call tocreate(ConnectionString)
.
-
-
-
Method Detail
-
create
public static MongoClient create()
Deprecated.Creates a new client with the default connection string "mongodb://localhost".- Returns:
- the client
-
create
public static MongoClient create(MongoClientSettings settings)
Deprecated.Create a new client with the given client settings.- Parameters:
settings
- the settings- Returns:
- the client
-
create
public static MongoClient create(java.lang.String connectionString)
Deprecated.Create a new client with the given connection string as if by a call tocreate(ConnectionString)
.- Parameters:
connectionString
- the connection- Returns:
- the client
- See Also:
create(ConnectionString)
-
create
public static MongoClient create(ConnectionString connectionString)
Deprecated.Create a new client with the given connection string.For each of the settings classed configurable via
MongoClientSettings
, the connection string is applied by calling theapplyConnectionString
method on an instance of setting's builder class, building the setting, and adding it to an instance ofMongoClientSettings.Builder
.The connection string's stream type is then applied by setting the
StreamFactory
to an instance of NettyStreamFactory,- Parameters:
connectionString
- the settings- Returns:
- the client
- Throws:
java.lang.IllegalArgumentException
- if the connection string's stream type is not one of "netty" or "nio2"- See Also:
MongoClientSettings.Builder.applyConnectionString(ConnectionString)
-
create
public static MongoClient create(ConnectionString connectionString, @Nullable MongoDriverInformation mongoDriverInformation)
Deprecated.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
- Throws:
java.lang.IllegalArgumentException
- if the connection string's stream type is not one of "netty" or "nio2"- See Also:
create(ConnectionString)
-
create
public static MongoClient create(MongoClientSettings settings, @Nullable MongoDriverInformation mongoDriverInformation)
Deprecated.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
-
-