Method: BSON::Object#to_bson_key

Defined in:
lib/bson/object.rb

#to_bson_keyObject

Objects that don’t override this method will raise an error when trying to use them as keys in a BSON document. This is only overridden in String and Symbol.

Examples:

Convert the object to a BSON key.

object.to_bson_key

Raises:

See Also:

Since:

  • 2.2.4



36
37
38
# File 'lib/bson/object.rb', line 36

def to_bson_key
  raise Error::InvalidKey.new(self)
end