class Monga::Protocol::Insert

Constants

FLAGS

Public Instance Methods

body() click to toggle source
# File lib/monga/protocol/insert.rb, line 9
def body
  @body ||= begin
    documents = @options[:documents]

    msg = ::BinUtils.append_int32_le!(nil, flags)
    msg << full_name << Monga::NULL_BYTE
    case documents
    when Array
      documents.each do |doc|
        msg << doc.to_bson
      end
    when Hash
      msg << documents.to_bson
    end
    msg
  end
end