Description
This returns an empty document:
#include <mongocxx/client.hpp>
|
#include <bsoncxx/builder/stream/document.hpp>
|
#include <bsoncxx/json.hpp>
|
|
|
#include <iostream>
|
|
|
using bsoncxx::builder::stream::document;
|
|
|
int main(int, char**) {
|
mongocxx::client conn{};
|
document command;
|
command << "buildInfo" << 1;
|
auto db = conn["test"];
|
auto result = db.command(command.view());
|
std::cout << "buildInfo response: " << bsoncxx::to_json(result.view()) << std::endl;
|
return 0;
|
|
}
|
(actually it crashes on exception, but that is due to CXX-587)
I tracked this down to missing initialization in scoped_bson_t reply object.
Patch in https://github.com/mongodb/mongo-cxx-driver/pull/284