
com.mongodb.reactivestreams.client.MongoClients Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongodb-driver-reactivestreams Show documentation
Show all versions of mongodb-driver-reactivestreams Show documentation
A Reactive Streams implementation of the MongoDB Java driver
/*
* Copyright 2014-2015 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mongodb.reactivestreams.client;
import com.mongodb.ConnectionString;
import com.mongodb.async.client.MongoClientSettings;
/**
* A factory for MongoClient instances.
*
*/
public final class MongoClients {
/**
* Creates a new client with the default connection string "mongodb://localhost".
*
* @return the client
*/
public static MongoClient create() {
return create(new ConnectionString("mongodb://localhost"));
}
/**
* Create a new client with the given client settings.
*
* @param settings the settings
* @return the client
*/
public static MongoClient create(final MongoClientSettings settings) {
return new MongoClientImpl(com.mongodb.async.client.MongoClients.create(settings));
}
/**
* Create a new client with the given connection string.
*
* @param connectionString the connection
* @return the client
*/
public static MongoClient create(final String connectionString) {
return create(new ConnectionString(connectionString));
}
/**
* Create a new client with the given connection string.
*
* @param connectionString the settings
* @return the client
*/
public static MongoClient create(final ConnectionString connectionString) {
return new MongoClientImpl(com.mongodb.async.client.MongoClients.create(connectionString));
}
private MongoClients() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy