Class MongoDBOptions

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

Represents the configuration for MongoDB.

public class MongoDBOptions
Inheritance
MongoDBOptions
Inherited Members
Extension Methods

Constructors

MongoDBOptions()

public MongoDBOptions()

Properties

ConnectionResolution

Gets or sets how connections are resolved per tenant, overriding the application-wide ConnectionResolution for MongoDB.

public ConnectionResolutionOptions ConnectionResolution { get; set; }

Property Value

ConnectionResolutionOptions

Remarks

When neither is configured, Server and Database are used as they are. A resolved connection string replaces Server, a resolved database replaces the database name, and a resolved identity becomes the credential — a user name and password for SCRAM, or an access token for MONGODB-OIDC.

Database

The database name.

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

Property Value

string

DirectConnection

Gets whether or use the direct connection option for MongoDB.

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". Setting this to true forces a direct connection to the configured server. When not set, the value from the connection string is preserved.

Server

The server url.

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

Property Value

string