Wrong time at Mongodb

5

When I put in MongoDB schema :

created: { type: Date, default: Date.now }

The time is 3 hours too long.

How can I fix this?

    
asked by anonymous 01.03.2015 / 17:09

1 answer

5

MongoDB works with UTC, that is, unfixed time zone. You will always have to consider this when using Date .

Since in Brazil the time zones are -3h and -4h you will always see more hours than your current one.

Unfortunately there is no real way to fix this display within MongoDB :(, but if you think otherwise this is also good as this means that you can have many applications in different time zones and all of them can work from a fixed date (UTC).

    
01.03.2015 / 23:07