Permalink
Browse files

call cbson directly to avoid more pack/unpack madness

  • Loading branch information...
1 parent 4a76261 commit e1f73c4e0651ff5f28ee95877adff8922254e32d @christophsturm christophsturm committed Sep 12, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/em-mongo/server_response.rb
@@ -21,10 +21,14 @@ def initialize(buffer, connection)
@number_returned = buffer.get_int
# Documents
- @docs = (1..number_returned).map do
+ pos=buffer.position
+ @docs = (1..@number_returned).map do
size= @connection.peek_size(buffer)
- buf = buffer.get(size)
- BSON::BSON_CODER.deserialize(buf)
+
+ doc=CBson.deserialize(buffer.to_s[pos,size])
+ pos+=size
+ buffer.position=pos
+ doc
end
end

0 comments on commit e1f73c4

Please sign in to comment.