aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-08-09 17:27:28 +0200
committerneodarz <neodarz@neodarz.net>2019-08-09 17:27:28 +0200
commit3185dd695d58bb96672d4f33c4528bf8b361707f (patch)
tree0f225ea42128ffc3c91bdea3ee24f1c2ff09396c
parent0442a35ae73500dbc396956e7d52474b1b9360f4 (diff)
downloadumosapicpp-3185dd695d58bb96672d4f33c4528bf8b361707f.tar.xz
umosapicpp-3185dd695d58bb96672d4f33c4528bf8b361707f.zip
Fix bson construction
Diffstat (limited to '')
-rw-r--r--db/uobject.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/db/uobject.cpp b/db/uobject.cpp
index bfaf7df..6401307 100644
--- a/db/uobject.cpp
+++ b/db/uobject.cpp
@@ -23,7 +23,11 @@ std::string uobject::add(std::string collection, struct json_object* jsonObject,
auto coll = (*conn)[config["mongo_db"]][collection];
- auto document = bsoncxx::from_json(body);
+ auto builder = bsoncxx::builder::stream::document{};
+
+ bsoncxx::document::value document = builder
+ << "datas" << bsoncxx::from_json(body)
+ << bsoncxx::builder::stream::finalize;
auto result = coll.insert_one(document.view());