Table of Contents

Class MongoDBOptions

Namespace
Cratis.Arc.MongoDB
Assembly
Cratis.Arc.MongoDB.dll

Represents the configuration for MongoDB.

public class MongoDBOptions
Inheritance
MongoDBOptions
Inherited Members

Constructors

MongoDBOptions()

public MongoDBOptions()

Properties

Database

The database name.

[Required]
public string Database { get; set; }

Property Value

string

DirectConnection

Gets whether or use the direct connection option for MongoDB. Defaults to false.

public bool DirectConnection { get; set; }

Property Value

bool

Remarks

The direct connection option is used to connect directly to a single MongoDB server, instead of using the replica set discovery mechanism. This can be useful for development and testing scenarios where a single MongoDB server is used. Also in scenarios where the MongoDB server is behind a load balancer or proxy that does not support the replica set discovery mechanism, or in a Docker compose environment and the single replicate points to "localhost". Settings this to true will add the "directConnection=true" query parameter to the connection string, and connect directly to the specified server.

Server

The server url.

[Required]
public string Server { get; set; }

Property Value

string