Parent

Methods

BSON::Document

This module provides behaviour for serializing and deserializing entire BSON documents, according to the BSON specification.

@note The specification is: document ::= int32 e_list “x00”

@see bsonspec.org/#/specification

@since 2.0.0

Public Instance Methods

[](key) click to toggle source

Get a value from the document for the provided key. Can use string or symbol access, but the fastest will be to always provide a key that is of the same type as the stored keys.

@example Get an element for the key.

document["field"]

@example Get an element for the key by symbol.

document[:field]

@param [ String, Symbol ] key The key to lookup.

@return [ Object ] The found value, or nil if none found.

@since 2.0.0

# File lib/bson/document.rb, line 52
def [](key)
  super(key) || super(key.to_s)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.