Poco::MongoDB

class MessageHeader

Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/MessageHeader.h

Description

Represents the message header which is always prepended to a MongoDB request or response message.

Member Summary

Member Functions: getMessageLength, getRequestID, opCode, read, responseTo, setRequestID, write

Enumerations

OpCode

OP_REPLY = 1

OP_UPDATE = 2001

OP_INSERT = 2002

OP_QUERY = 2004

OP_GET_MORE = 2005

OP_DELETE = 2006

OP_KILL_CURSORS = 2007

Opcodes supported in MongoDB 5.1 and later

OP_COMPRESSED = 2012

OP_MSG = 2013

Constructors

MessageHeader

explicit MessageHeader(
    OpCode
);

Creates the MessageHeader using the given OpCode.

Destructor

~MessageHeader virtual

virtual ~MessageHeader();

Destroys the MessageHeader.

Member Functions

getMessageLength inline

Int32 getMessageLength() const;

Returns the message length.

getRequestID inline

Int32 getRequestID() const;

Returns the request ID of the current message.

opCode inline

OpCode opCode() const;

Returns the OpCode.

read

void read(
    BinaryReader & reader
);

Reads the header using the given BinaryReader.

responseTo inline

Int32 responseTo() const;

Returns the request id from the original request.

setRequestID inline

void setRequestID(
    Int32 id
);

Sets the request ID of the current message.

write

void write(
    BinaryWriter & writer
);

Writes the header using the given BinaryWriter.

Variables

MSG_HEADER_SIZE static

static constexpr Int32 MSG_HEADER_SIZE = 16;