Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-592

database:command returns an empty response

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.2.0
    • None
    • API
    • None

    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

      Attachments

        Activity

          People

            adam.midvidy Adam Midvidy
            yhager Yuval Hager
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: