vibe.db.mongo.settings

MongoDB client connection settings.

Types 6

Describes a vibe.d supported authentication mechanism to use on client connection to a MongoDB server.

noneUse no auth mechanism. If a digest or ssl certificate is given this defaults to trying the recommend auth mechanisms depending on server version and input parameters.
scramSHA1Use SCRAM-SHA-1 as defined in [RFC 5802](http://tools.ietf.org/html/rfc5802)
scramSHA256Use SCRAM-SHA-256 as defined in [RFC 7677](http://tools.ietf.org/html/rfc7677)
mongoDBCRForces login through the legacy MONGODB-CR authentication mechanism. This mechanism is a nonce and MD5 based system.
mongoDBX509Use an X.509 certificate to authenticate. Only works if digest is set to null or empty string in the MongoClientSettings.

Specifies a level of isolation for read operations. For example, you can use read concern to only read data that has propagated to a majority of nodes in a replica set.

See Also

Fields
string levelThe level of the read concern.
Nested Templates
Level

Determines which replica set members are acceptable for read operations.

See Also

primaryRoute all reads to the primary. This is the default.
primaryPreferredRead from the primary if available, otherwise a secondary.
secondaryRoute all reads to secondaries.
secondaryPreferredRead from a secondary if available, otherwise the primary.
nearestRead from the member with the lowest network latency.
enumCompressor : ubyte

Compression algorithm identifier for OP_COMPRESSED wire protocol messages.

See Also

noop = 0
snappy = 1
zlib = 2
zstd = 3
Fields
ushort defaultPortGets the default port used for MongoDB connections
string usernameIf set to non-empty string, use this username to try to authenticate with to the database. Only has an effect if digest or sslPEMKeyFile is set too
string digestThe password hashed as MongoDB digest as returned by makeDigest.
string passwordThe raw password, needed for SCRAM-SHA-256 which does not use the MD5 digest. Stored alongside digest for backward compatibility.
uint maxConnectionsAmount of maximum simultaneous connections to have open at the same time.
MongoHost[] hostsMongoDB hosts to try to connect to.
string databaseDefault auth database to operate on, otherwise operating on special "admin" database for all MongoDB authentication commands.
string replicaSetSpecifies the name of the replica set, if the mongod is a member of a replica set. When set, the driver validates that any connected server belongs to this replica set and discovers the primary thr...
ReadPreference readPreferenceSpecifies the read preference mode for this connection.
long localThresholdMSUpper bound on the acceptable latency window for nearest server selection. Servers within (fastest RTT + localThresholdMS) are eligible. Default: 15ms per MongoDB spec.
long maxStalenessSecondsMaximum replication lag (in seconds) for a secondary to be eligible. -1 means no max staleness check. Minimum allowed value is 90 seconds.
ReadConcern readConcernSpecifies the default read concern level for read operations.
bool safeAutomatically check for errors when operating on collections and throw a MongoDBException in case of errors.
Bson wRequests acknowledgment that write operations have propagated to a specified number of mongod instances (number) or to mongod instances with specified tags (string) or "majority" for calculated maj...
long wTimeoutMSTime limit for the w option to prevent write operations from blocking indefinitely.
bool fsync
bool journalRequests acknowledgment that write operations have been written to the [on-disk journal](https://docs.mongodb.com/manual/core/journaling/).
Duration connectTimeoutThe time to attempt a connection before timing out.
Duration socketTimeoutThe time to attempt a send or receive on a socket before the attempt times out.
bool sslEnables or disables TLS/SSL for the connection.
bool sslverifycertificateCan be set to false to disable TLS peer validation to allow self signed certificates.
string sslPEMKeyFilePath to a certificate with private key and certificate chain to connect with.
string sslCAFilePath to a certificate authority file for verifying the remote certificate.
string authSourceSpecify the database name associated with the user's credentials. If `authSource` is unspecified, `authSource` defaults to the `defaultauthdb` specified in the connection string. If `defaultauthdb`...
MongoAuthMechanism authMechanismUse the given authentication mechanism when connecting to the server. If unsupported by the server, throw a MongoAuthException.
string[] authMechanismPropertiesSpecify properties for the specified authMechanism as a comma-separated list of colon-separated key-value pairs.
string appNameApplication name for the connection information when connected.
Compressor[] compressorsOrdered list of compression algorithms the client is willing to use. The server picks the first one it supports.
int zlibCompressionLevelCompression level for zlib (1-9). -1 means default (level 6).
Methods
long connectTimeoutMS() const @property @safeditto
void connectTimeoutMS(long ms) @property @safeditto
long socketTimeoutMS() const @property @safeditto
void socketTimeoutMS(long ms) @property @safeditto
string makeDigest(string username, string password) static pure @safeGenerates a digest string which can be used for authentication by setting the username and digest members.
void authenticatePassword(string username, string password) @safeSets the username and the digest string in this MongoClientSettings instance.
void authenticateSSL(string username, string sslPEMKeyFile, string sslCAFile = null) @safeSets ssl, the username, the PEM key file and the trusted CA file in this MongoClientSettings instance.
string getAuthDatabase() @safe @nogc nothrow pure const returnResolves the database to run authentication commands on. (authSource if set, otherwise the URI's database if set, otherwise "admin")
structMongoHost

Describes a host we might be able to connect to

Fields
string nameThe host name or IP address of the remote MongoDB server.
ushort portThe port of the MongoDB server. See `MongoClientSettings.defaultPort`.
Methods
bool opEquals(const MongoHost other) const @safe @nogc pure nothrow

Functions 3

fnbool parseMongoDBUrl(out MongoClientSettings cfg, string url) @safeParses the given string as a mongodb URL. The URL must be in the form documented at http://www.mongodb.org/display/DOCS/Connections which is:
fnstring compressorName(Compressor c) @safe pure nothrow
fnMongoHost parseHostPort(string hostPort) @safe pure nothrowParses a "host:port" string into a MongoHost. Returns MongoHost.init if the string cannot be parsed.