Class MongoClient.Database
An object representing a remote MongoDB database.
Namespace: Realms.Sync
Assembly: Realm.dll
Syntax
public class MongoClient.Database
Properties
| Edit this page View SourceClient
Gets the MongoClient that manages this database.
Declaration
public MongoClient Client { get; }
Property Value
Type | Description |
---|---|
MongoClient | The database's MongoClient. |
Name
Gets the name of the database.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string | The database name. |
Methods
| Edit this page View SourceGetCollection(string)
Gets a collection from the database.
Declaration
public MongoClient.Collection<BsonDocument> GetCollection(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the collection. |
Returns
Type | Description |
---|---|
MongoClient.Collection<BsonDocument> | A MongoClient.Collection<TDocument> instance that exposes an API for CRUD operations on its contents. |
GetCollection<TDocument>(string)
Gets a collection from the database.
Declaration
public MongoClient.Collection<TDocument> GetCollection<TDocument>(string name) where TDocument : class
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the collection. |
Returns
Type | Description |
---|---|
MongoClient.Collection<TDocument> | A MongoClient.Collection<TDocument> instance that exposes an API for CRUD operations on its contents. |
Type Parameters
Name | Description |
---|---|
TDocument | The managed type that matches the shape of the documents in the collection. |
Remarks
The MongoDB Bson library is used
to decode the response. It will automatically handle most cases, but if you want to control the behavior
of the deserializer, you can use the attributes in the
MongoDB.Bson.Serialization.Attributes
namespace.
If you want to modify the global conventions used when deserializing the response, such as convert
camelCase properties to PascalCase, you can register a
ConventionPack.