Method: Mongo::Protocol::Serializers::Sections::PayloadZero.deserialize

Defined in:
lib/mongo/protocol/serializers.rb

.deserialize(buffer, options = {}) ⇒ 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 0 of an OP_MSG from the IO stream.

Parameters:

  • buffer (BSON::ByteBuffer)

    Buffer containing the sections.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :deserialize_as_bson (Boolean)

    Whether to perform section deserialization using BSON types instead of native Ruby types wherever possible.

Returns:

  • (Array<BSON::Document>)

    Deserialized section.

Since:

  • 2.5.0



287
288
289
290
# File 'lib/mongo/protocol/serializers.rb', line 287

def self.deserialize(buffer, options = {})
  mode = options[:deserialize_as_bson] ? :bson : nil
  BSON::Document.from_bson(buffer, **{ mode: mode })
end