lib/mongo/protocol/msg.rb
# Validate that the documents in this message are all smaller than the
# maxBsonObjectSize. If not, raise an exception.
Validate that the documents in this message are all smaller than the
maxBsonObjectSize. If not, raise an exception.
Validate that the documents in this message are all smaller than the maxBsonObjectSize . If not raise an exception .
def validate_document_size!(max_bson_size)
        max_bson_size ||= Mongo::Server::ConnectionBase::DEFAULT_MAX_BSON_OBJECT_SIZE
        contains_too_large_document = @sections.any? do |section|
          section[:type] == 1 &&
            section[:payload][:sequence].any? do |document|
              document.to_bson.length > max_bson_size
            end
        end
        if contains_too_large_document
          raise Error::MaxBSONSize.new('The document exceeds maximum allowed BSON object size after serialization')
        end
      end
def validate_document_size! ( max_bson_size ) max_bson_size ||= Mongo :: Server :: ConnectionBase :: DEFAULT_MAX_BSON_OBJECT_SIZE contains_too_large_document = @sections . any? do | section | section [ :type ] == 1 && section [ :payload ] [ :sequence ] . any? do | document | document . to_bson . length > max_bson_size end end if contains_too_large_document raise Error :: MaxBSONSize . new ( 'The document exceeds maximum allowed BSON object size after serialization' ) end end
Validate that the documents in this message are all smaller than the
maxBsonObjectSize.
Validate that the documents in this message are all smaller than the maxBsonObjectSize .
max_bson_size
<not_specific>