public final class MongoClients extends Object
Modifier and Type | Method and 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,
ObservableAdapter observableAdapter)
Create a new client with the given connection string.
|
static MongoClient |
create(com.mongodb.ConnectionString connectionString,
ObservableAdapter observableAdapter,
com.mongodb.client.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.MongoClient asyncMongoClient,
ObservableAdapter observableAdapter)
Creates a new client with the given async MongoClient.
|
static MongoClient |
create(com.mongodb.async.client.MongoClientSettings settings)
Create a new client with the given client settings.
|
static MongoClient |
create(com.mongodb.async.client.MongoClientSettings settings,
ObservableAdapter observableAdapter)
Create a new client with the given client settings.
|
static MongoClient |
create(com.mongodb.async.client.MongoClientSettings settings,
ObservableAdapter observableAdapter,
com.mongodb.client.MongoDriverInformation mongoDriverInformation)
Creates a new client with the given client settings.
|
static MongoClient |
create(String connectionString)
Create a new client with the given connection string.
|
static MongoClient |
create(String connectionString,
ObservableAdapter observableAdapter)
Create a new client with the given connection string.
|
static org.bson.codecs.configuration.CodecRegistry |
getDefaultCodecRegistry()
Gets the default codec registry.
|
public static MongoClient create()
public static MongoClient create(com.mongodb.async.client.MongoClientSettings settings)
settings
- the settingspublic static MongoClient create(com.mongodb.async.client.MongoClientSettings settings, ObservableAdapter observableAdapter)
settings
- the settingsobservableAdapter
- the ObservableAdapter
to adapt all Observables
public static MongoClient create(String connectionString)
connectionString
- the connectionpublic static MongoClient create(String connectionString, ObservableAdapter observableAdapter)
connectionString
- the connectionobservableAdapter
- the ObservableAdapter
to adapt all Observables
public static MongoClient create(com.mongodb.ConnectionString connectionString)
connectionString
- the settingspublic static MongoClient create(com.mongodb.ConnectionString connectionString, ObservableAdapter observableAdapter)
connectionString
- the settingsobservableAdapter
- the ObservableAdapter
to adapt all Observables
.public static MongoClient create(com.mongodb.ConnectionString connectionString, ObservableAdapter observableAdapter, com.mongodb.client.MongoDriverInformation mongoDriverInformation)
Note: Intended for driver and library authors to associate extra driver metadata with the connections.
connectionString
- the settingsobservableAdapter
- the ObservableAdapter
to adapt all Observables
.mongoDriverInformation
- any driver information to associate with the MongoClientpublic static MongoClient create(com.mongodb.async.client.MongoClientSettings settings, ObservableAdapter observableAdapter, com.mongodb.client.MongoDriverInformation mongoDriverInformation)
Note: Intended for driver and library authors to associate extra driver metadata with the connections.
settings
- the settingsobservableAdapter
- the ObservableAdapter
to adapt all Observables
.mongoDriverInformation
- 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 MongoClient create(com.mongodb.async.client.MongoClient asyncMongoClient, ObservableAdapter observableAdapter)
Note: This shares the MongoClient
between two APIs. Calling close from either API will close the client.
asyncMongoClient
- the async MongoClientobservableAdapter
- the ObservableAdapter
to adapt all Observables
.public static org.bson.codecs.configuration.CodecRegistry getDefaultCodecRegistry()
MongoClientSettings.getCodecRegistry()