Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-59701

Error when working with some timezones when using external timezones database

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.4, 5.1.0-rc0
    • Affects Version/s: 5.0.2
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Hide
      1. Install and run MongoDB according to the official tutorial
        1. Ubuntu 20.04
        2. or Amazon Linux
      2. Execute the following queries via the shell:
        test> db.data.insertOne({ dt: new ISODate() })
        {
          acknowledged: true,
          insertedId: ObjectId("612ecf6c7a7e22f6c7e00e53")
        }
        test> db.data.aggregate([
        ...     {
        .....         "$project": {
        .......             "dtTimezone": {
        .........                 "$dateToString": {
        ...........                     "date": "$dt",
        ...........                     "timezone": "Etc/UTC"
        ...........                 }
        .........             }
        .......         }
        .....     }
        ... ])
        MongoServerError: PlanExecutor error during aggregation :: caused by :: unrecognized time zone identifier: "Etc/UTC"
        test> db.data.aggregate([
        ...     {
        .....         "$project": {
        .......             "dtTimezone": {
        .........                 "$dateToString": {
        ...........                     "date": "$dt",
        ...........                     "timezone": "Europe/London"
        ...........                 }
        .........             }
        .......         }
        .....     }
        ... ])
        [
          {
            _id: ObjectId("612ecf6c7a7e22f6c7e00e53"),
            dtTimezone: '2021-09-01T01:55:08.009Z'
          }
        ]
        
      Show
      Install and run MongoDB according to the official tutorial Ubuntu 20.04 or Amazon Linux Execute the following queries via the shell: test> db.data.insertOne({ dt: new ISODate() }) { acknowledged: true , insertedId: ObjectId( "612ecf6c7a7e22f6c7e00e53" ) } test> db.data.aggregate([ ... { ..... "$project" : { ....... "dtTimezone" : { ......... "$dateToString" : { ........... "date" : "$dt" , ........... "timezone" : "Etc/UTC" ........... } ......... } ....... } ..... } ... ]) MongoServerError: PlanExecutor error during aggregation :: caused by :: unrecognized time zone identifier: "Etc/UTC" test> db.data.aggregate([ ... { ..... "$project" : { ....... "dtTimezone" : { ......... "$dateToString" : { ........... "date" : "$dt" , ........... "timezone" : "Europe/London" ........... } ......... } ....... } ..... } ... ]) [ { _id: ObjectId( "612ecf6c7a7e22f6c7e00e53" ), dtTimezone: '2021-09-01T01:55:08.009Z' } ]
    • QE 2021-10-04

      I get an error when executing queries with some timezones, such as Etc/UTC or Etc/GMT+12, while the same queries with other timezones, such as Europe/London, work correctly. The error occurs when specifying the processManagement.timeZoneInfo parameter, which is set by default to /usr/share/zoneinfo. When omitting this parameter and using the built-in database, the error does not occur. Downloading and using the timezone archive from the documentation, as advised in SERVER-41948, does not solve the problem.

            Assignee:
            mohammad.dashti@mongodb.com Mohammad Dashti (Inactive)
            Reporter:
            maximzasorin@gmail.com Maxim Zasorin
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: