module Mongo::DBRef::ClassMethods

Public Instance Methods

from_bson(buffer) click to toggle source

Deserialize the hash from BSON, converting to a DBRef if appropriate.

@param [ String ] buffer The bson representing a hash.

@return [ Hash, DBRef ] The decoded hash or DBRef.

@see bsonspec.org/#/specification

@since 2.0.0

Calls superclass method
# File lib/mongo/dbref.rb, line 103
def from_bson(buffer)
  decoded = super
  if ref = decoded[COLLECTION]
    decoded = DBRef.new(ref, decoded[ID], decoded[DATABASE])
  end
  decoded
end