-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
We store a field of variable types. It can be an array of String, Date or Time in any quantity and combinations.
ruby
class Artwork
include Mongoid::Document
field :dates, type: Array
end
Mongoid 2.x
ruby Artwork.new({ dates: [ Date.parse("3/5/2011") ]}).dates.first.class => Date
Mongoid 3.x
ruby Artwork.new({ dates: [ Date.parse("3/5/2011") ]}).dates.first.class => Time
Is this by design or a bug? I would expect that storing a date returns a date. Is there an easy way to get old behavior back?