title: how to serialize ArrayBuffer into BSON object for websocket transfer in javascript
body: <p>I want encode a <strong>javascript object</strong> with a <strong>ArrayBuffer element</strong> into <code>BSON</code> and transfer it over <code>websocket</code>.  However the serialized BSON object is 10 time bigger than it should be.</p>
  
  <p>The code is something like this:</p>
  
  <pre><code>var A = {buffer: new ArrayBuffer(1024)};
  
  bson_buffer_size = BSON.calculateObjectSize(A) // returns 9164, I am expecting ~1024
  </code></pre>
  
  <p>My understanding of BSON serializer must be wrong.  Does anyone know how I can create a compact BSON object with a binary buffer field?</p>