Fix num_documents & facet fields not returned when creating a new collection.

This commit is contained in:
Kishore Nallan 2018-03-29 08:08:22 +05:30
parent 6ab5514af0
commit 6cdbb29d4a
2 changed files with 10 additions and 3 deletions

View File

@ -32,7 +32,7 @@ public:
return is_ok;
}
T get() {
T get() const {
return value;
}

View File

@ -120,8 +120,15 @@ void post_create_collection(http_req & req, http_res & res) {
}
const std::string & default_sorting_field = req_json[DEFAULT_SORTING_FIELD].get<std::string>();
collectionManager.create_collection(req_json["name"], fields, default_sorting_field);
res.send_201(req.body);
const Option<Collection*> & collection_op =
collectionManager.create_collection(req_json["name"], fields, default_sorting_field);
if(collection_op.ok()) {
nlohmann::json json_response = collection_summary_json(collection_op.get());
return res.send_201(json_response.dump());
}
return res.send(collection_op.code(), collection_op.error());
}
void del_drop_collection(http_req & req, http_res & res) {