public final class MongoClients
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static MongoClient |
create()
Creates a new client with the default connection string "mongodb://localhost".
|
static MongoClient |
create(ConnectionString connectionString)
Create a new client with the given connection string.
|
static MongoClient |
create(ConnectionString connectionString,
MongoDriverInformation mongoDriverInformation)
Create a new client with the given connection string.
|
static MongoClient |
create(com.mongodb.async.client.MongoClient asyncMongoClient)
Creates a new client with the given async MongoClient.
|
static MongoClient |
create(com.mongodb.async.client.MongoClientSettings settings)
Deprecated.
use
create(com.mongodb.MongoClientSettings) instead |
static MongoClient |
create(MongoClientSettings settings)
Create a new client with the given client settings.
|
static MongoClient |
create(com.mongodb.async.client.MongoClientSettings settings,
MongoDriverInformation mongoDriverInformation)
Deprecated.
use
create(com.mongodb.MongoClientSettings) instead |
static MongoClient |
create(MongoClientSettings settings,
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 CodecRegistry |
getDefaultCodecRegistry()
Gets the default codec registry.
|
public static MongoClient create()
@Deprecated public static MongoClient create(com.mongodb.async.client.MongoClientSettings settings)
create(com.mongodb.MongoClientSettings) insteadsettings - the settingspublic static MongoClient create(java.lang.String connectionString)
connectionString - the connectionpublic static MongoClient create(ConnectionString connectionString)
connectionString - the settingspublic static MongoClient create(ConnectionString connectionString, MongoDriverInformation mongoDriverInformation)
Note: Intended for driver and library authors to associate extra driver metadata with the connections.
connectionString - the settingsmongoDriverInformation - any driver information to associate with the MongoClient@Deprecated public static MongoClient create(com.mongodb.async.client.MongoClientSettings settings, MongoDriverInformation mongoDriverInformation)
create(com.mongodb.MongoClientSettings) insteadNote: Intended for driver and library authors to associate extra driver metadata with the connections.
settings - the settingsmongoDriverInformation - any driver information to associate with the MongoClientpublic static MongoClient create(MongoClientSettings settings)
settings - the settingspublic static MongoClient create(MongoClientSettings settings, MongoDriverInformation mongoDriverInformation)
Note: Intended for driver and library authors to associate extra driver metadata with the connections.
settings - the settingsmongoDriverInformation - any driver information to associate with the MongoClientpublic static MongoClient create(com.mongodb.async.client.MongoClient asyncMongoClient)
Note: This shares the MongoClient between two APIs. Calling close from either API will close the client.
asyncMongoClient - the async MongoClientpublic static CodecRegistry getDefaultCodecRegistry()
MongoClientSettings.getCodecRegistry()