26 #if defined(_WIN32) || defined(_WIN64)
30 #define strcasecmp _stricmp
34 #include <mongo/bson/bson.h>
35 #include "../repo_node_utils.h"
36 #include "repo_bson.h"
55 const std::string &label,
56 const std::vector<T> &vec)
59 for (
unsigned int i = 0; i < vec.size(); ++i)
60 array.append(std::to_string(i), vec[i]);
61 mongo::BSONObjBuilder::appendArray(label, array.
obj());
65 const std::string &label,
68 mongo::BSONObjBuilder::appendArray(label, bson);
73 const std::string &label,
76 mongo::BSONObjBuilder::append(label, item);
87 const std::string &label,
88 const std::list<std::pair<std::string, std::string> > &list,
89 const std::string &fstLabel,
90 const std::string &sndLabel
106 const std::string &label,
108 const uint32_t &byteCount)
110 if (data && 0 < byteCount)
115 label, byteCount, mongo::BinDataGeneral,
118 catch (std::exception &e)
120 repoError <<
"Failed: " << e.what();
126 repoWarning <<
"Trying to append a binary of size 0 into a bson. Skipping..";
130 void appendTimeStamp(std::string label){
131 appendTime(label, time(NULL) * 1000);
134 void appendTime(std::string label,
const int64_t &ts){
135 mongo::Date_t date = mongo::Date_t(ts);
136 mongo::BSONObjBuilder::append(label, date);
154 const std::string &label,
155 const repoUUID &uuid);
159 template<>
void RepoBSONBuilder::append < repoUUID >
161 const std::string &label,
165 template<>
void RepoBSONBuilder::append < repo_vector_t >
167 const std::string &label,
Definition: repo_connection_pool_mongo.h:32
RepoBSON obj()
Definition: repo_bson_builder.cpp:46
void appendArray(const std::string &label, const std::vector< T > &vec)
Definition: repo_bson_builder.h:54
Definition: repo_node_utils.h:67
Definition: repo_bson.h:53
Definition: repo_bson_builder.h:41
void appendArrayPair(const std::string &label, const std::list< std::pair< std::string, std::string > > &list, const std::string &fstLabel, const std::string &sndLabel)
Definition: repo_bson_builder.cpp:21
void appendBinary(const std::string &label, const T *data, const uint32_t &byteCount)
Definition: repo_bson_builder.h:105