Module: Mongo::DBRef::ClassMethods
- Defined in:
- lib/mongo/dbref.rb
Overview
Instance Method Summary collapse
-
#from_bson(buffer, **options) ⇒ Hash, DBRef
Deserialize the hash from BSON, converting to a DBRef if appropriate.
Instance Method Details
#from_bson(buffer, **options) ⇒ Hash, DBRef
Deserialize the hash from BSON, converting to a DBRef if appropriate.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/mongo/dbref.rb', line 103 def from_bson(buffer, **) # 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 .empty? super(buffer) else super end if ref = decoded[COLLECTION] decoded = DBRef.new(ref, decoded[ID], decoded[DATABASE]) end decoded end |