All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mongodb.async.client.MongoClient Maven / Gradle / Ivy

There is a newer version: 3.12.14
Show newest version
/*
 * Copyright (c) 2008-2014 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.async.client;

import com.mongodb.annotations.Immutable;
import org.bson.Document;

import java.io.Closeable;

/**
 * A client-side representation of a MongoDB cluster.  Instances can represent either a standalone MongoDB instance, a replica set,
 * or a sharded cluster.  Instance of this class are responsible for maintaining an up-to-date state of the cluster,
 * and possibly cache resources related to this, including background threads for monitoring, and connection pools.
 * 

* Instance of this class server as factories for {@code MongoDatabase} instances. *

* @since 3.0 */ @Immutable public interface MongoClient extends Closeable { /** * Gets the database with the given name. * * @param name the name of the database * @return the database */ MongoDatabase getDatabase(String name); /** * Close the client, which will close all underlying cached resources, including, for example, * sockets and background monitoring threads. */ void close(); /** * Gets the options that this client uses to connect to server. * *

Note: {@link MongoClientOptions} is immutable.

* * @return the options */ MongoClientOptions getOptions(); /** * Get a list of the database names * * @mongodb.driver.manual reference/commands/listDatabases List Databases * @return an iterable containing all the names of all the databases */ MongoIterable listDatabaseNames(); /** * Gets the list of databases * * @return the fluent list databases interface */ ListDatabasesFluent listDatabases(); /** * Gets the list of databases * * @param clazz the class to cast the database documents to * @param the type of the class to use instead of {@code Document}. * @return the fluent list databases interface */ ListDatabasesFluent listDatabases(Class clazz); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy