MySQL Connector/C++
MySQL connector library for C and C++ applications
Public Member Functions | List of all members
CollectionAdd Class Reference

An operation which adds documents to a collection. More...

Public Member Functions

 CollectionAdd (Collection &coll)
 Create an empty add operation for the given collection.
 
template<typename It >
CollectionAddadd (const It &begin, const It &end)
 Add all documents from a range defined by two iterators.
 
template<class Container >
CollectionAddadd (const Container &c)
 Add all documents within given container. More...
 
template<typename... Types>
CollectionAddadd (const Types &... docs)
 Add document(s) to a collection. More...
 
virtual Result execute ()
 Execute given operation and return its result.
 
virtual Result execute ()
 Execute given operation and return its result.
 
virtual Result execute ()
 Execute given operation and return its result.
 

Detailed Description

An operation which adds documents to a collection.

Documents to be added by this operation are specified with various variants of add() method.

Each document must have a unique identifier which is stored in _id field of the document. Document identifiers are character strings no longer than 32 characters. If added document does not have _id field, a unique identifier is generated for it. Document identifier generated by a given collection add operation can be examined using Result::getDocumentIds() method. Generated document identifiers are strings of 32 hexadecimal digits, like this one 0512020981044082E6119DFA0E4C0584.

Note
Generated document identifiers are based on UUIDs but they are not valid UUIDs (fields are reversed).

Member Function Documentation

◆ add() [1/2]

CollectionAdd & add ( const Container &  c)
inline

Add all documents within given container.

Any container type for which std::begin()/std::end() are defined should work.

◆ add() [2/2]

CollectionAdd & add ( const Types &...  docs)
inline

Add document(s) to a collection.

Documents can be described by JSON strings or DbDoc objects.


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