I have such trouble: when I'm creating object and setting some datetime It is saving database in UTC TimeZone. Here is example:
//showing full list of object properties
Grant _id: 5108ee29e6b564611400000, start_date: 2013-01-30 09:56:27 UTC
//then showing a.start_date
Wed, 30 Jan 2013 13:56:27 +0400
I tried to forbid database to use UTC. Here is mongoid.yml:
development:
options:
raise_not_found_error: false
sessions:
default:
use_activesupport_time_zone: true
use_utc: false
database: test_mongoid_production
hosts:
- localhost:27017
options:
consistency: :strong
and in application.rb:
config.time_zone = 'Moscow'
but it doesn't work.
Can someone help with this trouble ?
You can change the timezone of your application so that ruby's date object will auto configure the dates. MongoDB will always store time in UTC.
MongoDB has no internal knowledge of timezones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With