| MongoDatabase Methods | 
The MongoDatabase type exposes the following members.
 Methods
Methods| Name | Description | |
|---|---|---|
|  | AddUser | Obsolete. 
            Adds a user to this database.
             | 
|  | CollectionExists | 
            Tests whether a collection exists on this database.
             | 
|  | CreateCollection(String) | 
            Creates a collection. MongoDB creates collections automatically when they are first used, so
            this command is mainly here for frameworks.
             | 
|  | CreateCollection(String, IMongoCollectionOptions) | 
            Creates a collection. MongoDB creates collections automatically when they are first used, so
            you only need to call this method if you want to provide non-default options.
             | 
|  | CreateView | 
            Creates a view.
             | 
|  | Drop | 
            Drops a database.
             | 
|  | DropCollection | 
            Drops a collection.
             | 
|  | Equals | Determines whether the specified object is equal to the current object.(Inherited from Object.) | 
|  | Eval(EvalArgs) | 
            Evaluates JavaScript code at the server.
             | 
|  | Eval(BsonJavaScript, Object) | Obsolete. 
            Evaluates JavaScript code at the server.
             | 
|  | Eval(EvalFlags, BsonJavaScript, Object) | Obsolete. 
            Evaluates JavaScript code at the server.
             | 
|  | FetchDBRef | 
            Fetches the document referred to by the DBRef.
             | 
|  | FetchDBRefAs(Type, MongoDBRef) | 
            Fetches the document referred to by the DBRef.
             | 
|  | FetchDBRefAsTDocument(MongoDBRef) | 
            Fetches the document referred to by the DBRef, deserialized as a TDocument.
             | 
|  | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) | 
|  | FindAllUsers | Obsolete. 
            Finds all users of this database.
             | 
|  | FindUser | Obsolete. 
            Finds a user of this database.
             | 
|  | GetCollection(String) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of BsonDocument.
             | 
|  | GetCollection(String, MongoCollectionSettings) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of TDefaultDocument.
             | 
|  | GetCollection(String, WriteConcern) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of BsonDocument.
             | 
|  | GetCollection(Type, String) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of BsonDocument.
             | 
|  | GetCollection(Type, String, MongoCollectionSettings) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of BsonDocument.
             | 
|  | GetCollection(Type, String, WriteConcern) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of BsonDocument.
             | 
|  | GetCollectionTDefaultDocument(String) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of TDefaultDocument.
             | 
|  | GetCollectionTDefaultDocument(String, MongoCollectionSettings) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of TDefaultDocument.
             | 
|  | GetCollectionTDefaultDocument(String, WriteConcern) | 
            Gets a MongoCollection instance representing a collection on this database
            with a default document type of TDefaultDocument.
             | 
|  | GetCollectionNames | 
            Gets a list of the names of all the collections in this database.
             | 
|  | GetCurrentOp | 
            Gets the current operation.
             | 
|  | GetGridFS | 
            Gets an instance of MongoGridFS for this database using custom GridFS settings.
             | 
|  | GetHashCode | Serves as the default hash function. (Inherited from Object.) | 
|  | GetProfilingInfo | 
            Gets one or more documents from the system.profile collection.
             | 
|  | GetProfilingLevel | 
            Gets the current profiling level.
             | 
|  | GetSisterDatabase | 
            Gets a sister database on the same server.
             | 
|  | GetStats | 
            Gets the current database stats.
             | 
|  | GetType | Gets the Type of the current instance.(Inherited from Object.) | 
|  | IsCollectionNameValid | 
            Checks whether a given collection name is valid in this database.
             | 
|  | MemberwiseClone | Creates a shallow copy of the current Object.(Inherited from Object.) | 
|  | RemoveUser(String) | Obsolete. 
            Removes a user from this database.
             | 
|  | RemoveUser(MongoUser) | Obsolete. 
            Removes a user from this database.
             | 
|  | RenameCollection(String, String) | 
            Renames a collection on this database.
             | 
|  | RenameCollection(String, String, Boolean) | 
            Renames a collection on this database.
             | 
|  | RunCommand(String) | 
            Runs a command on this database.
             | 
|  | RunCommand(IMongoCommand) | 
            Runs a command on this database.
             | 
|  | RunCommandAs(Type, IMongoCommand) | 
            Runs a command on this database and returns the result as a TCommandResult.
             | 
|  | RunCommandAs(Type, String) | 
            Runs a command on this database and returns the result as a TCommandResult.
             | 
|  | RunCommandAsTCommandResult(String) | 
            Runs a command on this database and returns the result as a TCommandResult.
             | 
|  | RunCommandAsTCommandResult(IMongoCommand) | 
            Runs a command on this database and returns the result as a TCommandResult.
             | 
|  | RunCommandAsTCommandResult(IMongoCommand, ReadPreference) | 
            Runs a command on this database and returns the result as a TCommandResult.
             | 
|  | SetProfilingLevel(ProfilingLevel) | 
            Sets the level of profile information to write.
             | 
|  | SetProfilingLevel(ProfilingLevel, TimeSpan) | 
            Sets the level of profile information to write.
             | 
|  | ToString | 
            Gets a canonical string representation for this database.
            (Overrides ObjectToString.) | 
|  | WithReadConcern | 
            Returns a new MongoDatabase instance with a different read concern setting.
             | 
|  | WithReadPreference | 
            Returns a new MongoDatabase instance with a different read preference setting.
             | 
|  | WithWriteConcern | 
            Returns a new MongoDatabase instance with a different write concern setting.
             | 
 Extension Methods
Extension Methods| Name | Description | |
|---|---|---|
|  | ToBson | 
            Serializes an object to a BSON byte array.
            (Defined by BsonExtensionMethods.) | 
|  | ToBsonDocument | 
            Serializes an object to a BsonDocument.
            (Defined by BsonExtensionMethods.) | 
|  | ToJson | 
            Serializes an object to a JSON string.
            (Defined by BsonExtensionMethods.) | 
 See Also
See Also