diff --git a/MongoDB/include/Poco/MongoDB/Element.h b/MongoDB/include/Poco/MongoDB/Element.h index 25cdafe6b..b0578c063 100644 --- a/MongoDB/include/Poco/MongoDB/Element.h +++ b/MongoDB/include/Poco/MongoDB/Element.h @@ -137,7 +137,7 @@ struct ElementTraits static std::string toString(const std::string& value) { - return value; + return '"' + value + '"'; } }; @@ -175,7 +175,7 @@ struct ElementTraits template<> inline void BSONReader::read(bool& to) { - Int32 b; + unsigned char b; _reader >> b; to = b != 0; } @@ -183,7 +183,8 @@ inline void BSONReader::read(bool& to) template<> inline void BSONWriter::write(bool& from) { - _writer << (from ? 0x01 : 0x00); + unsigned char b = from ? 0x01 : 0x00; + _writer << b; } // BSON 32-bit integer