Method: Mongo::Server::AppMetadata::Truncator#initialize

Defined in:
lib/mongo/server/app_metadata/truncator.rb

#initialize(document) ⇒ Truncator

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.

Note:

The document is modified in-place; if you wish to keep the original unchanged, you must deep-clone it prior to sending it to a truncator.

Creates a new Truncator instance and tries enforcing the maximum document size on the given document.

Parameters:

  • document (BSON::Document)

    The document to (potentially) truncate.

Since:

  • 2.0.0



40
41
42
43
# File 'lib/mongo/server/app_metadata/truncator.rb', line 40

def initialize(document)
  @document = document
  try_truncate!
end