I'm having a weird issue with MongoDB in Windows 10. I've migrated a database that's working perfectly fine in MacOS and Linux to a Windows 10 machine.
Same mongodb version : 3.4.7
The issue seems to be related to one that other people experienced but it's not exactly the same (question question)
I get an error saying "gmtime failed - your system doesn't support dates before 1970" when I call a view that uses $dateToString in the projection.
And I also get only 101 records if I call the same view via Robo 3T.
But the difference in my case is that I don't have dates before 1970 in this particular collection.
So I ran this code on Robo 3T to try something, and I can't understand the result:
db.getCollection('vehicles').find({}).forEach(function(vehicle){
var date = new Date(vehicle.dates.entry);
print(date);
print(date.getYear());
})
This is the result for one record:
Fri Oct 02 2015 00:00:00 GMT+0100 (GMT Standard Time)
115
So the date seems to be constructed properly but the getYear() returns 115 instead of 2015.
The same code on MacOS or Linux works as expected.
Any ideas? Thanks