-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.2
-
Component/s: JavaScript
-
None
-
ALL
-
Dev Tools 2019-03-11
Something strange with server-updated Timestamps. Unsure if this is a bug or expected behaviour that is not documented re interaction with timezones.
Observed in NodeJS driver and confirmed in shell (e.g. below).
Timestamps are being created +1 hour ahead of system localtime.
I believe mongod should always use UTC. Otherwise, daylight saving time zones would break ordering guarantees.
Why is mongod creating timestamps using UTC+1 instead of UTC?
$ mongo MongoDB shell version v3.6.2 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.2 Server has startup warnings: 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost. 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server. 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning. 2019-02-11T09:00:56.005+0000 I CONTROL [initandlisten] > db.test_time.insert({ _id: 1, ts: new Timestamp(0,0) }); WriteResult({ "nInserted" : 1 }) > let r = db.test_time.findOne({_id: 1}); > let d = new Date(0); > d.setSeconds(r.ts.toJSON().$timestamp.t) 1550242948000 > d ISODate("2019-02-15T15:02:28Z") > ^C bye $ zdump /etc/localtime /etc/localtime Fri Feb 15 14:03:49 2019 GMT $ ls -l /etc/localtime lrwxr-xr-x 1 root wheel 39 17 Oct 15:13 /etc/localtime -> /var/db/timezone/zoneinfo/Europe/London