module Mongo::DBRef::ClassMethods
Public Instance Methods
Source
# File lib/mongo/dbref.rb, line 103 def from_bson(buffer, **options) # bson-ruby 4.8.0 changes #from_bson API to take **options. # However older bsons fail if invoked with a plain super here, # even if options are empty. decoded = if options.empty? super(buffer) else super end if ref = decoded[COLLECTION] decoded = DBRef.new(ref, decoded[ID], decoded[DATABASE]) end decoded end
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