def read
      with_connection do |socket|
        reply = Protocol::Reply.allocate
        data = read_data(socket, 36)
        response = data.unpack(REPLY_DECODE_STR)
        reply.length,
          reply.request_id,
          reply.response_to,
          reply.op_code,
          reply.flags,
          reply.cursor_id,
          reply.offset,
          reply.count = response

        if reply.count == 0
          reply.documents = []
        else
          sock_read = read_data(socket, reply.length - 36)
          buffer = StringIO.new(sock_read)
          reply.documents = reply.count.times.map do
            ::BSON::Document.from_bson(buffer)
          end
        end
        reply
      end
    end
def read
      with_connection do |socket|
        reply = Protocol::Reply.allocate
        data = read_data(socket, 36)
        response = data.unpack(REPLY_DECODE_STR)
        reply.length,
          reply.request_id,
          reply.response_to,
          reply.op_code,
          reply.flags,
          reply.cursor_id,
          reply.offset,
          reply.count = response

        if reply.count == 0
          reply.documents = []
        else
          sock_read = read_data(socket, reply.length - 36)
          buffer = StringIO.new(sock_read)
          reply.documents = reply.count.times.map do
            ::BSON::Document.from_bson(buffer)
          end
        end
        reply
      end
    end
Initialize the connection.

 @example Initialize the connection.
   Connection.new("localhost", 27017, 5)

 @param [ String ] host The host to connect to.
 @param [ Integer ] post The server port.
 @param [ Integer ] timeout The connection timeout.
 @param [ Hash ] options Options for the connection.

 @option options [ Boolean ] :ssl Connect using SSL
 @since 1.0.0
 Read from the connection.

 @example Read from the connection.
   connection.read

 @return [ Hash ] The returned document.

 @since 1.0.0