Module: BSON::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/bson/config.rb

Overview

Provides configuration options for the BSON library.

Since:

  • 4.1.0

Instance Method Summary collapse

Instance Method Details

#validating_keys=(value) ⇒ true, false

Set the configuration option for BSON to validate keys or not.

Examples:

Set the config option.

BSON::Config.validating_keys = true

Parameters:

  • value (true, false)

    The value to set.

Returns:

  • (true, false)

    The value.

Since:

  • 4.1.0



33
34
35
# File 'lib/bson/config.rb', line 33

def validating_keys=(value)
  @validating_keys = value
end

#validating_keys?true, false

Returns true if BSON will validate the document keys on serialization to determine if they contain invalid MongoDB values. Invalid keys start with ‘$’ or contain a ‘.’ in them.

Examples:

Is BSON validating keys?

BSON::Config.validating_keys?

Returns:

  • (true, false)

    If BSON is validating keys?

Since:

  • 4.1.0



47
48
49
# File 'lib/bson/config.rb', line 47

def validating_keys?
  !!@validating_keys
end