MongoDB C++ Driver  mongocxx-3.1.0
Public Member Functions | List of all members
mongocxx::insert_many_builder Class Reference

Class to build an insert_many bulk write operation. More...

#include <insert_many_builder.hpp>

Public Member Functions

 insert_many_builder (const options::insert &options)
 Initializes a new builder for an insert_many bulk write operation. More...
 
void operator() (const bsoncxx::document::view &doc)
 Appends a single insert to insert_many bulk write operation. More...
 
stdx::optional< result::insert_manyinsert (collection *col) const
 Executes the underlying insert_many bulk operation. More...
 

Detailed Description

Class to build an insert_many bulk write operation.

This can be used on its own, or called through the helper mongocxx::collection::insert_many.

Constructor & Destructor Documentation

mongocxx::insert_many_builder::insert_many_builder ( const options::insert options)
explicit

Initializes a new builder for an insert_many bulk write operation.

Parameters
optionsThe options for this insert_many.

Member Function Documentation

stdx::optional<result::insert_many> mongocxx::insert_many_builder::insert ( collection col) const

Executes the underlying insert_many bulk operation.

Parameters
colA pointer to the collection into which the documents will be inserted.
void mongocxx::insert_many_builder::operator() ( const bsoncxx::document::view doc)

Appends a single insert to insert_many bulk write operation.

The document is copied into the bulk operation completely, so there is no dependency between the life of the document and the insert_many bulk write operation itself.

Parameters
docThe next document to be added to the insert_many operation.

The documentation for this class was generated from the following file: