ruby on rails - How to store UTC time values in Mongo with Mongoid? -


I see with the Mongoode Adapter that it will save the 'Time' field from the current system timezone database. Note that this is the system time and the environment time of the rail is not the zones. If I change the system time zone, then it saves the timezone of the current system.

  Currently on record UTC-7- # record Time_attribute = Time.now.utc @ record.save # In Mongo, the value is "time_tribbut": "Mon May 17 2010 12:00:00 GMT-0700 (QYZST)" @ record.reload.time_attribute.utc? # False  

use_utc to set up the Mongoode configuration parameter Try true .

It indicates that you want to return the time to UTC:


Comments