vibe.db.mongo.connection
Low level mongodb protocol.
Copyright
Types 12
D POD representation of Mongo error object.
For successful queries "code" is negative. Can be used also to check how many documents where updated upon a successful query via "n" field.
Root class for vibe.d Mongo driver exception hierarchy.
this(string message, string file = __FILE__, size_t line = __LINE__, Throwable next = null)Generic class for all exception related to unhandled driver problems.
I.e.: protocol mismatch or unexpected mongo service behavior.
this(string message, string file = __FILE__, size_t line = __LINE__, Throwable next = null)Wrapper class for all inner mongo collection manipulation errors.
It does not indicate problem with vibe.d driver itself. Most frequently this one is thrown when MongoConnection is in checked mode and getLastError() has something interesting.
MongoErrorDescription descriptionthis(MongoErrorDescription description, string file = __FILE__,
size_t line = __LINE__, Throwable next = null)Generic class for all exceptions related to authentication problems.
I.e.: unsupported mechanisms or wrong credentials.
this(string message, string file = __FILE__, size_t line = __LINE__, Throwable next = null)[internal] Provides low-level mongodb protocol access.
It is not intended for direct usage. Please use vibe.db.mongo.db and vibe.db.mongo.collection modules for your code. Note that a MongoConnection may only be used from one fiber/thread at a time.
ushort defaultPortvoid connectToHost(MongoHost host, bool doAuthenticate = true) @safevoid disconnect() @safebool alive() @property @safeChecks if the connection is alive by probing the socket for remote close.void update(string collection_name, UpdateFlags flags, Bson selector, Bson update) @safevoid insert(string collection_name, InsertFlags flags, Bson[] documents) @safevoid query(T)(string collection_name, QueryFlags flags, int nskip, int nret, Bson query, Bson returnFieldSelector, scope ReplyDelegate on_msg, scope DocDelegate!T on_doc) @safeBson runCommand(T, CommandFailException = MongoDriverException)(
string database,
Bson command,
string errorInfo = __FUNCTION__,
string errorFile = __FILE__,
size_t errorLine = __LINE__
) @safeRuns the given Bson command (Bson object with the first entry in the map being the command name) on the given database.Bson runCommandUnchecked(T, CommandFailException = MongoDriverException)(
string database,
Bson command,
string errorInfo = __FUNCTION__,
string errorFile = __FILE__,
size_t errorLine = __LINE__
) @safevoid startFind(T)(Bson command,
scope GetMoreHeaderDelegate on_header,
scope GetMoreDocumentDelegate!T on_doc,
string batchKey = "firstBatch",
string errorInfo = __FUNCTION__, string errorFile = __FILE__, size_t errorLine = __LINE__) @safeForwards the `find` command passed in to the database, handles the callbacks like with getMore. This exists for easier integration with MongoCursor!T.void delete_(string collection_name, DeleteFlags flags, Bson selector) @safevoid killCursors(scope long[] cursors) @safevoid killCursors(string collection, scope long[] cursors) @safeMongoErrorDescription getLastError(string db) @safethis(string server, ushort port = defaultPort)Simplified constructor overload, with no m_settingsthis(MongoClientSettings cfg)getMore(T)string namedouble sizeOnDiskbool emptyBsonObjectID processIdlong counterstring addressstring errorfloat roundTripTimeLastWrite lastWriteNullable!BsonObjectID opTimeServerType typeint minWireVersionstring mestring[] hostsstring[string] tagsstring setNameNullable!int setVersionNullable!BsonObjectID electionIdstring primaryNullable!TopologyVersion topologyVersionbool secondaryDeprecated since MongoDB 5.0: the `isMaster` command was replaced by `hello`. The `secondary` field itself is still present in the `hello` response.bool ismasterDeprecated since MongoDB 5.0: renamed to `isWritablePrimary` in the `hello` command response. True if the instance is a primary, mongos, or standalone mongod.bool isWritablePrimarybool arbiterOnlystring msgNullable!int logicalSessionTimeoutMinutesstring[] compressionlong lastUpdateTimeUsecsSet by the driver after probing, not deserialized from the server response.ServerTypeLastWriteFunctions 2
bool matchesReplicaSet(string expectedSet, ref const ServerDescription desc) @safe @nogc pure nothrowChecks whether the server's replica set name matches the expected one. Returns true if no replica set is configured (empty string) or if the names match.ServerDescription probeServer(MongoClientSettings settings, MongoHost host) @safeProbes a MongoDB host by performing a hello handshake without authentication.