[CXX-592] database:command returns an empty response Created: 01/May/15  Updated: 15/May/15  Resolved: 11/May/15

Status: Closed
Project: C++ Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 0.2.0

Type: New Feature Priority: Major - P3
Reporter: Yuval Hager Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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



 Comments   
Comment by Adam Midvidy [ 11/May/15 ]

Thanks again for your work on this yhager.

Generated at Wed Feb 07 21:59:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.