/* Copyright 2013-2016 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. */ using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Driver.Core.Clusters; namespace MongoDB.Driver { /// /// The client interface to MongoDB. /// /// /// This interface is not guaranteed to remain stable. Implementors should use /// . /// public interface IMongoClient { /// /// Gets the cluster. /// /// /// The cluster. /// ICluster Cluster { get; } /// /// Gets the settings. /// MongoClientSettings Settings { get; } /// /// Drops the database with the specified name. /// /// The name of the database to drop. /// The cancellation token. void DropDatabase(string name, CancellationToken cancellationToken = default(CancellationToken)); /// /// Drops the database with the specified name. /// /// The name of the database to drop. /// The cancellation token. /// A task. Task DropDatabaseAsync(string name, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a database. /// /// The name of the database. /// The database settings. /// An implementation of a database. IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null); /// /// Lists the databases on the server. /// /// The cancellation token. /// A cursor. IAsyncCursor ListDatabases(CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the databases on the server. /// /// The cancellation token. /// A Task whose result is a cursor. Task> ListDatabasesAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns a new IMongoClient instance with a different read concern setting. /// /// The read concern. /// A new IMongoClient instance with a different read concern setting. IMongoClient WithReadConcern(ReadConcern readConcern); /// /// Returns a new IMongoClient instance with a different read preference setting. /// /// The read preference. /// A new IMongoClient instance with a different read preference setting. IMongoClient WithReadPreference(ReadPreference readPreference); /// /// Returns a new IMongoClient instance with a different write concern setting. /// /// The write concern. /// A new IMongoClient instance with a different write concern setting. IMongoClient WithWriteConcern(WriteConcern writeConcern); } }