From 3185dd695d58bb96672d4f33c4528bf8b361707f Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 9 Aug 2019 17:27:28 +0200 Subject: Fix bson construction --- db/uobject.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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()); -- cgit v1.2.1