1

I am inserting a lot of documents with a date in mongodb but the time doesn't match...

The time on the document is 1 hour early from the inserted time. Is it my mongo server who's not well configured ? Or do I have to do something else ?

I insert all the documents with a java application.

Thanks

Phoste
  • 1,141
  • 4
  • 18
  • 34
  • 1
    Related [mongodb ISODate problems](http://stackoverflow.com/questions/20941687) – chridam Jan 13 '16 at 14:48
  • did the answer below help solving your problem? If it helped, please accept it to help those who have similar problem. If it did not help, please let me know so that I can delete it to save people from wasting their time looking at it. – innoSPG Jan 26 '16 at 17:26
  • 1
    Yes it helped me. thanks :) – Phoste Jan 27 '16 at 08:46

1 Answers1

3

You possibly have 1 hour time difference compared to UTC. You have to account for your locale because mongodb store date as UTC timestamp.

MongoDB stores times in UTC by default, and will convert any local time representations into this form. Applications that must operate or report on some unmodified local time value may store the time zone alongside the UTC timestamp, and compute the original local time in their application logic.

Also see this page for more details.

innoSPG
  • 4,588
  • 1
  • 29
  • 42