Method: Mongo::Protocol::Serializers::Sections::PayloadOne.deserialize
- Defined in:
- lib/mongo/protocol/serializers.rb
.deserialize(buffer) ⇒ Array<BSON::Document>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deserializes a section of payload type 1 of an OP_MSG from the IO stream.
337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/mongo/protocol/serializers.rb', line 337 def self.deserialize(buffer) raise NotImplementedError start_size = buffer.length section_size = buffer.get_int32 # get the size end_size = start_size - section_size buffer.get_cstring # get the identifier documents = [] until buffer.length == end_size documents << BSON::Document.from_bson(buffer) end documents end |