Class Poco::MongoDB::InsertRequest
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::MongoDB

# class InsertRequest

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

## Description

Class for creating an OP_INSERT client request. This request is used to insert one or more documents to the database.

## Inheritance

Direct Base Classes: RequestMessage

All Base Classes: Message, RequestMessage

## Member Summary

Member Functions: addNewDocument, buildRequest, documents

Inherited Functions: buildRequest, header, messageLength, send

## Types

### INSERT_NONE

typedef enum { INSERT_NONE = 0, INSERT_CONTINUE_ON_ERROR = 1 } Flags;

## Constructors

### InsertRequest

InsertRequest(
const std::string & collectionName,
Flags flags = INSERT_NONE
);

Constructor. The full collection name is the concatenation of the database name with the collection name, using a "." for the concatenation. For example, for the database "foo" and the collection "bar", the full collection name is "foo.bar".

## Destructor

### ~InsertRequest

virtual ~InsertRequest();

Destructor

## Member Functions

### addNewDocument

Document & addNewDocument();

Adds a new document for insertion. A reference to the empty document is returned. InsertRequest is the owner of the Document and will free it on destruction.

### documents

Document::Vector & documents();

Returns the documents to insert into the database

### buildRequest

void buildRequest(
BinaryWriter & writer
);

See also: Poco::MongoDB::RequestMessage::buildRequest()