-
Type: Task
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.10.2
-
Component/s: BSON
-
None
Hi guys..
We are using the driver in an ETL project that converts dates. I'm a bit puzzled with this behavior.
We inserted this record:
{ "_id" : "ZRH", "id" : "ZRH", "name" : "Zürich", "population" : 300000, "factor" : 0.81191, "createDate" : ISODate("1245-04-28T13:27:32.000Z"), "createDateString" : ISODate("1984-05-02T00:00:00.000Z"), "isGood" : false, "countryExtRef" : { "ref" : DBRef("Country", "CHE") }, "_loadModifiedData !Screenshot from 2019-06-26 14-34-29.png|thumbnail! " : false, "_loadCreatedAt" : ISODate("2019-06-26T12:16:48.524Z"), "recordOrigin" : "faker" },
The problem is with the "createDate" field - as you see it's 1245-04-28T13:27:32.000Z
Later in the application (well, in our integration tests), i fetch the entity back:
Document singleRecord = city.find(eq("_id", "ZRH")).first();
I get this:
So what I see saved in MongoDB is ISODate("1245-04-28T13:27:32.000Z") - I get back "Fri Apr 21 13:27:32 UTC 1245" - somehow 7 days were lost?
Sadly I lack the ability to really diagnostic this problem - I see that the BSON reader gets the value "-23973085975000" in readInt64() for the specific datetime. This indeed is the rendered Date (April 21).. Which is strange as mongo shell shows me April 28 (which is what I inserted)..
Any ideas what could be wrong? Thank you so much!