New C++ Mongo driver: how to see type and how to get string value New C++ Mongo driver: how to see type and how to get string value mongodb mongodb

New C++ Mongo driver: how to see type and how to get string value


  1. Printing Type as string (LIGNE 67)

    #include <bsoncxx/types.hpp>std::string bsoncxx::to_string(bsoncxx::type rhs);`
  2. element to std::string

    stdx::string_view view = e.get_utf8().value;string name = view.to_string();


#include <bsoncxx/types.hpp>std::cout << bsoncxx::to_string(bsoncxx::types::b_utf8::type_id);

result: "utf8"

And these are type of bsoncxx

namespace types {struct b_eod;struct b_double;struct b_utf8;struct b_document;struct b_array;struct b_binary;struct b_undefined;struct b_oid;struct b_bool;struct b_date;struct b_null;struct b_regex;struct b_dbpointer;struct b_code;struct b_symbol;struct b_codewscope;struct b_int32;struct b_timestamp;struct b_int64;struct b_minkey;struct b_maxkey;class value;}  // namespace types