# Poco

# namespace MongoDB

## Overview

Classes: Array, BSONReader, BSONTimestamp, BSONWriter, Binary, ConcreteElement, Connection, Database, Document, Element, ElementFindByName, ElementPtrCompare, ElementTraits, JavaScriptCode, Message, MessageHeader, ObjectId, OpMsgCursor, OpMsgMessage, PooledConnection, PooledReplicaSetConnection, ReadPreference, RegularExpression, ReplicaSet, ReplicaSetConnection, ReplicaSetURI, ServerDescription, TopologyChangeNotification, TopologyDescription

Types Aliases: NullValue

## Classes

### class Array

This class represents a BSON Array.

### class BSONReader

Class for reading BSON using a Poco::BinaryReader

### struct BSONTimestamp

### class BSONWriter

Class for writing BSON using a Poco::BinaryWriter.

### class Binary

Implements BSON Binary.

### class ConcreteElement

### class Connection

Represents a connection to a MongoDB server using the MongoDB wire protocol.

### class Database

Database is a helper class for creating requests.

### class Document

Represents a MongoDB (BSON) document.

### class Element

Represents an Element of a Document or an Array.

### class ElementFindByName

### struct ElementPtrCompare

Comparison functor for Element::Ptr with transparent lookup support (C++14+).

### struct ElementTraits

### class JavaScriptCode

Represents JavaScript type in BSON.

### class Message

Base class for all messages send or retrieved from MongoDB server.

### class MessageHeader

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

### class ObjectId

ObjectId is a 12-byte BSON type, constructed using: - a 4-byte timestamp, - a 3-byte machine identifier, - a 2-byte process id, and - a 3-byte counter, starting with a random value.

### class OpMsgCursor

OpMsgCursor is a helper class for querying multiple documents using OpMsgMessage.

### class OpMsgMessage

This class represents a request/response (OP_MSG) to send requests and receive responses to/from MongoDB.

### class PooledConnection

Helper class for borrowing and returning a connection automatically from a pool.

### class PooledReplicaSetConnection

Helper class for borrowing and returning a ReplicaSetConnection automatically from a pool.

### class ReadPreference

Configures read preference mode and constraints for MongoDB operations.

### class RegularExpression

Represents a regular expression in BSON format.

### class ReplicaSet

Class for working with a MongoDB replica set.

### class ReplicaSetConnection

Wrapper around Connection that provides automatic retry and failover for MongoDB replica set operations.

### class ReplicaSetURI

Class for parsing and generating MongoDB replica set URIs.

### class ServerDescription

Represents the state of a single MongoDB server in a replica set.

### class TopologyChangeNotification

Notification sent when MongoDB replica set topology changes.

### class TopologyDescription

Maintains the complete MongoDB replica set topology state.

## Types Aliases

### NullValue

using NullValue = Nullable < unsigned char >;

## Variables

### BSON_MAX_DOCUMENT_SIZE

static constexpr Poco::Int32 BSON_MAX_DOCUMENT_SIZE = 16 * 1024 * 1024;

Minimum BSON document size (5 bytes): 4-byte size field + 1-byte null terminator.

### BSON_MIN_DOCUMENT_SIZE

static constexpr Poco::Int32 BSON_MIN_DOCUMENT_SIZE = 5;

Minimum BSON string size (1 byte for the null terminator).

### BSON_MIN_STRING_SIZE

static constexpr Poco::Int32 BSON_MIN_STRING_SIZE = 1;

Maximum OP_MSG message size (48 MB) per MongoDB specification.

### DEFAULT_LOCAL_THRESHOLD_US

static constexpr Poco::Int64 DEFAULT_LOCAL_THRESHOLD_US = 15000;

### OP_MSG_MAX_SIZE

static constexpr Poco::Int32 OP_MSG_MAX_SIZE = 48 * 1024 * 1024;

Default local threshold for "nearest" read preference (15 ms = 15000 µs). Servers within this threshold of the minimum RTT are eligible for selection.