Click or drag to resize

MongoDatabase Methods

The MongoDatabase type exposes the following members.

Methods
  NameDescription
Public methodAddUser Obsolete.
Adds a user to this database.
Public methodCollectionExists
Tests whether a collection exists on this database.
Public methodCreateCollection(String)
Creates a collection. MongoDB creates collections automatically when they are first used, so this command is mainly here for frameworks.
Public methodCreateCollection(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.
Public methodCreateView
Creates a view.
Public methodDrop
Drops a database.
Public methodDropCollection
Drops a collection.
Public methodEquals (Inherited from Object.)
Public methodEval(EvalArgs)
Evaluates JavaScript code at the server.
Public methodEval(BsonJavaScript, Object) Obsolete.
Evaluates JavaScript code at the server.
Public methodEval(EvalFlags, BsonJavaScript, Object) Obsolete.
Evaluates JavaScript code at the server.
Public methodFetchDBRef
Fetches the document referred to by the DBRef.
Public methodFetchDBRefAs(Type, MongoDBRef)
Fetches the document referred to by the DBRef.
Public methodFetchDBRefAsTDocument(MongoDBRef)
Fetches the document referred to by the DBRef, deserialized as a TDocument.
Protected methodFinalize (Inherited from Object.)
Public methodFindAllUsers Obsolete.
Finds all users of this database.
Public methodFindUser Obsolete.
Finds a user of this database.
Public methodGetCollection(String)
Gets a MongoCollection instance representing a collection on this database with a default document type of BsonDocument.
Public methodGetCollection(String, MongoCollectionSettings)
Gets a MongoCollection instance representing a collection on this database with a default document type of TDefaultDocument.
Public methodGetCollection(String, WriteConcern)
Gets a MongoCollection instance representing a collection on this database with a default document type of BsonDocument.
Public methodGetCollection(Type, String)
Gets a MongoCollection instance representing a collection on this database with a default document type of BsonDocument.
Public methodGetCollection(Type, String, MongoCollectionSettings)
Gets a MongoCollection instance representing a collection on this database with a default document type of BsonDocument.
Public methodGetCollection(Type, String, WriteConcern)
Gets a MongoCollection instance representing a collection on this database with a default document type of BsonDocument.
Public methodGetCollectionTDefaultDocument(String)
Gets a MongoCollection instance representing a collection on this database with a default document type of TDefaultDocument.
Public methodGetCollectionTDefaultDocument(String, MongoCollectionSettings)
Gets a MongoCollection instance representing a collection on this database with a default document type of TDefaultDocument.
Public methodGetCollectionTDefaultDocument(String, WriteConcern)
Gets a MongoCollection instance representing a collection on this database with a default document type of TDefaultDocument.
Public methodGetCollectionNames
Gets a list of the names of all the collections in this database.
Public methodGetCurrentOp
Gets the current operation.
Public methodGetGridFS
Gets an instance of MongoGridFS for this database using custom GridFS settings.
Public methodGetHashCode (Inherited from Object.)
Public methodGetProfilingInfo
Gets one or more documents from the system.profile collection.
Public methodGetProfilingLevel
Gets the current profiling level.
Public methodGetSisterDatabase
Gets a sister database on the same server.
Public methodGetStats
Gets the current database stats.
Public methodGetType (Inherited from Object.)
Public methodIsCollectionNameValid
Checks whether a given collection name is valid in this database.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRemoveUser(String) Obsolete.
Removes a user from this database.
Public methodRemoveUser(MongoUser) Obsolete.
Removes a user from this database.
Public methodRenameCollection(String, String)
Renames a collection on this database.
Public methodRenameCollection(String, String, Boolean)
Renames a collection on this database.
Public methodRunCommand(String)
Runs a command on this database.
Public methodRunCommand(IMongoCommand)
Runs a command on this database.
Public methodRunCommandAs(Type, IMongoCommand)
Runs a command on this database and returns the result as a TCommandResult.
Public methodRunCommandAs(Type, String)
Runs a command on this database and returns the result as a TCommandResult.
Public methodRunCommandAsTCommandResult(String)
Runs a command on this database and returns the result as a TCommandResult.
Public methodRunCommandAsTCommandResult(IMongoCommand)
Runs a command on this database and returns the result as a TCommandResult.
Public methodRunCommandAsTCommandResult(IMongoCommand, ReadPreference)
Runs a command on this database and returns the result as a TCommandResult.
Public methodSetProfilingLevel(ProfilingLevel)
Sets the level of profile information to write.
Public methodSetProfilingLevel(ProfilingLevel, TimeSpan)
Sets the level of profile information to write.
Public methodToString
Gets a canonical string representation for this database.
(Overrides ObjectToString.)
Public methodWithReadConcern
Returns a new MongoDatabase instance with a different read concern setting.
Public methodWithReadPreference
Returns a new MongoDatabase instance with a different read preference setting.
Public methodWithWriteConcern
Returns a new MongoDatabase instance with a different write concern setting.
Top
Extension Methods
  NameDescription
Public Extension MethodToBson
Serializes an object to a BSON byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument
Serializes an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson
Serializes an object to a JSON string.
(Defined by BsonExtensionMethods.)
Top
See Also