vibe.db.mongo.connection

Low level mongodb protocol.

Types 19

private struct_MongoErrorDescription
Fields
string message
int code
int connectionId
int n
double ok
aliasMongoErrorDescription = immutable(_MongoErrorDescription)

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.

classMongoException : Exception

Root class for vibe.d Mongo driver exception hierarchy.

Constructors
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.

Constructors
this(string message, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
deprecated Check for MongoException instead - the modern write commands now throw MongoBulkWriteException on error

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.

Fields
Methods
int code() @property const nothrow
int connectionId() @property const nothrow
int n() @property const nothrow
double ok() @property const nothrow
Constructors
this(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.

Constructors
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.

Fields
TCPConnection m_conn
InterfaceProxy!Stream m_stream
ulong m_bytesRead
int m_msgid
StreamOutputRange!(InterfaceProxy!Stream) m_outRange
ServerDescription m_description
bool m_allowReconnectFlag to prevent recursive connections when server closes connection while connecting
bool m_isAuthenticating
bool m_supportsOpMsg
ushort defaultPort
Methods
void connect()
void disconnect()
bool connected() @property const
const(ServerDescription) description() @property const
void update(string collection_name, UpdateFlags flags, Bson selector, Bson update)
void insert(string collection_name, InsertFlags flags, Bson[] documents)
void query(T)(string collection_name, QueryFlags flags, int nskip, int nret, Bson query, Bson returnFieldSelector, scope ReplyDelegate on_msg, scope DocDelegate!T on_doc)
Bson runCommand(T, CommandFailException = MongoDriverException)( string database, Bson command, string errorInfo = __FUNCTION__, string errorFile = __FILE__, size_t errorLine = __LINE__ )Runs 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__ )
private Bson runCommandImpl(T, CommandFailException)( string database, Bson command, bool testOk = true, string errorInfo = __FUNCTION__, string errorFile = __FILE__, size_t errorLine = __LINE__ )
void 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__)Forwards 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)
void killCursors(scope long[] cursors)
void killCursors(string collection, scope long[] cursors)
auto listDatabases()Queries the server for all databases.
private int recvMsg(bool dupBson = true)(int reqid, scope MsgReplyDelegate!dupBson on_sec0, scope MsgSection1StartDelegate on_sec1_start, scope MsgSection1Delegate!dupBson on_sec1_doc)
private int recvReply(T)(int reqid, scope ReplyDelegate on_msg, scope DocDelegate!T on_doc)
private int send(ARGS...)(OpCode code, int response_to, scope ARGS args)
private int sendMsg(int response_to, uint flagBits, Bson document)
private void sendValue(T)(scope T value)
private void sendBytes(scope const(ubyte)[] data){
private T recvInteger(T)()
private Bson recvBson(ref ubyte[] buf) @system
private Bson recvBsonDup() @trusted
private void recv(scope ubyte[] dst)
private const(char)[] recvCString()
private int nextMessageId()
private void checkForError(string collection_name)
private void certAuthenticate()
private void authenticate()
private void scramAuthenticate()
Constructors
this(string server, ushort port = defaultPort)Simplified constructor overload, with no m_settings
Nested Templates
getMore(T)
private enumOpCode : int
Reply = 1
Update = 2001
Insert = 2002
Reserved1 = 2003
Query = 2004
GetMore = 2005
Delete = 2006
KillCursors = 2007
Compressed = 2012
Msg = 2013
private aliasReplyDelegate = void delegate(long cursor, ReplyFlags flags, int first_doc, int num_docs) @safe
private aliasMsgReplyDelegate(bool dupBson : true) = void delegate(uint flags, Bson document) @safe
private aliasMsgReplyDelegate(bool dupBson : false) = void delegate(uint flags, scope Bson document) @safe
private aliasMsgSection1StartDelegate = void delegate(scope const(char)[] identifier, int size) @safe
private aliasMsgSection1Delegate(bool dupBson : true) = void delegate(scope const(char)[] identifier, Bson document) @safe
private aliasMsgSection1Delegate(bool dupBson : false) = void delegate(scope const(char)[] identifier, scope Bson document) @safe
aliasGetMoreHeaderDelegate = void delegate(long id, string ns, size_t count) @safe
aliasGetMoreDocumentDelegate(T) = void delegate(ref T document) @safe
Fields
string name
double sizeOnDisk
bool empty
Fields
string address
string error
float roundTripTime
Nullable!BsonDate lastWriteDate
Nullable!BsonObjectID opTime
ServerType type
int minWireVersion
string me
string[] hosts
string[string] tags
string setName
Nullable!int setVersion
Nullable!BsonObjectID electionId
string primary
string lastUpdateTime
Nullable!int logicalSessionTimeoutMinutes
Methods
bool satisfiesVersion(WireVersion wireVersion) @safe const @nogc pure nothrow
Nested Templates
ServerType
enumWireVersion : int
old = 0
v26 = 1
v26_2 = 2
v30 = 3
v32 = 4
v34 = 5
v36 = 6
v40 = 7
v42 = 8
v44 = 9
v49 = 12
v50 = 13
v51 = 14
v52 = 15
v53 = 16
v60 = 17

Functions 2

private fnint sendLength(ARGS...)(scope ARGS args)
private fnstring getHostArchitecture()

Variables 1

private vargetHostArchitecture hostArchitecture

Templates 1

tmplDocDelegate(T)