Class MongoClient
The remote MongoClient used for working with data in MongoDB remotely via Realm.
Namespace: Realms.Sync
Assembly: Realm.dll
Syntax
public class MongoClient
Properties
| Edit this page View SourceServiceName
Gets the service name for this client.
Declaration
public string ServiceName { get; }
Property Value
Type | Description |
---|---|
string | The name of the remote MongoDB service. |
Methods
| Edit this page View SourceGetCollection<TRealmObject>()
Gets a collection of documents from MongoDB that can be deserialized in Realm objects.
Declaration
public MongoClient.Collection<TRealmObject> GetCollection<TRealmObject>() where TRealmObject : class, IRealmObjectBase
Returns
Type | Description |
---|---|
MongoClient.Collection<TRealmObject> | A MongoClient.Collection<TDocument> instance that exposes an API for CRUD operations on its contents. |
Type Parameters
Name | Description |
---|---|
TRealmObject | The Realm object type that matches the shape of the documents in the collection. |
Remarks
This method is only supported for source-generated classes - i.e. ones that inherit from IRealmObject rather than RealmObject. The collection and database name are automatically derived from the Realm object class.
GetDatabase(string)
Gets a MongoClient.Database instance for the given database name.
Declaration
public MongoClient.Database GetDatabase(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the database to retrieve. |
Returns
Type | Description |
---|---|
MongoClient.Database | A MongoClient.Database instance that exposes an API for querying its collections. |