-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Ruby Drivers
-
None
-
None
-
None
-
None
-
None
-
None
BSON::Document#to_h does not convert nested hashes. I think this behavior is non-optimal/surprising:
doc = BSON::Document.new({"foo" => {"bar" => 100}}) doc.class #=> BSON::Document -- OK doc['foo'].class #=> BSON::Document -- OK hash = doc.to_h hash.class #=> Hash -- OK hash['foo'].class #=> BSON::Document -- YIKES, UNEXPECTED!!
I think this is probably ok to fix without adding a feature flag, since BSON::Document is already "duck-typed" to have the same methods as Hash, I can't imagine fixing it will actually break any apps.