title: bsoncxx::to_json return corrupted string
body: <p>I'm having difficulties converting a bson document to a json string using bsoncxx.
  The bsoncxx::to_json function return an "invalid"/corrupted std::string object..
  I can't read the character in it, and it crash when the std::string is destructed..</p>
  
  <p>I've rebuild everything: mongoc,libbson, mongocxx, etc...</p>
  
  <p>Here's a sample code :</p>
  
  <pre><code>bsoncxx::builder::basic::document doc{};
  doc.append(bsoncxx::builder::basic::kvp("test", 1));
  auto string = bsoncxx::to_json(doc);
  </code></pre>
  
  <p>I can't extract the data from the string, because std::end(string) crash with a "read access violation" when I try to copy the content with std::copy...</p>
  
  <p><a href="https://i.stack.imgur.com/eJykF.png" rel="nofollow"><img src="https://i.stack.imgur.com/eJykF.png" alt="Image"></a></p>
  
  <p>I'm using mongodb everywhere in the program and accessing bson documents and everything works fine. I tried to call bsoncxx::to_json on an already existing bson document returned by a mongodb query but it had the same behavior...</p>
  
  <p>I'm trying to stream a byte array ( plus, some information like how to decode the byte array ) using boost tcp sockets to a nodejs program so I thought I could simply create a document with a "binary field", convert it to json and stream it over the tcp socket...</p>
  
  <p>Anyone knows how I could do that, either by fixing the bsoncxx::to_json, or by using something else ?</p>
  
  <p>thanks</p>
  
  <p>Edit:</p>
  
  <p>For information, I'm compiling with Visual Studio 2015 on Windows 10 x64</p>