0
我使用mongoid 6.0.3Mongoid哈希類型成爲後BSON ::文檔中查找
class C
include Mongoid::Document
field :h, type: Hash, default: {}
end
c = C.new
c.h = {"a" => "b"}
c.save!
puts c.h.class # gives Hash
saved_c = C.find(c.id)
puts saved_c.h.class # gives BSON::Document
我錯過了什麼?我找不到爲什麼在簡單查找後哈希變成了BSON :: Document?