[SERVER-41948] MongoDB not supporting all standard timezones Created: 27/Jun/19 Updated: 22/Sep/21 Resolved: 16/Aug/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 3.6.0, 3.6.13 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Alexandru Martin | Assignee: | Kelsey Schubert |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
A specific AMI/repo results in a MongoDB deployment returning "unrecognized time zone identifier" for the command "db.test.aggregate([{$project: {"hour": {$hour:{date: "$dt", timezone:"Etc/GMT+7"}}}}])". The command works fine on many other 3.6.13 installations/instances. This reproduces using:
original descriptionHello! I was trying to make a project like this:
where $eventCreatedAt is always an ISODate and $timezone can be any standard timezone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones I saw that when the timezone is Etc/GMT+7 mongo throws an exception saying it is not recognized.
I have read the documentation which states that the recognized timezones are:
My question is why there not supported all standard timezonez such as Etc/GMT+7 ? All programming languages supports them so mongo why not? In the end that is a standard and shoul be completely covered. |
| Comments |
| Comment by Kelsey Schubert [ 16/Aug/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi axiodis, I'm not aware of any issues around changing the mongod's timezone. All date type objects are stored as UTC, so there shouldn't be any different between documents before or after or across different nodes. Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. Questions like this involving more discussion would be best posted on the mongodb-users group. Kind regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 09/Aug/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We managed to solve the problem on a test standalone mongo server by commenting the line
and forcing mongo to use its internal timezones database. So the problem is that the timezones database from the operating system that mongodb is reading is not up to date and must be updated either manually like you pointed out(A) or automatically through the package manager. Manually updating i am certain it is not a good idea giving the fact that there may be other applications using it and it may cause problems. Giving the fact that on the production server we can not automatically update the OS timezones database through the package manager as there isn't any updates we must either use your second solution (B) or our solution by commenting that line and letting mongo to use its internal database. As you can see this 2 cases are almost identical as we must change the configuration file and we cannot do this without additional info:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Sedor [ 26/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for your patience, axiodis A colleague has pointed me at this documentation that could describe what's going on. Can you try either A) updating /usr/share/zoneinfo with the mentioned zip file, or B) extracting that file to another location and providing an explicit --timeZoneInfo config pointing there? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Sedor [ 17/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks axiodis, I have been able to reproduce this using:
I am passing this ticket to an appropriate team for deeper investigation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 11/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We encountered the same problem on both ami ids: Our test ami on which we have run the second test: amzn2-ami-hvm-2.0.20190618-x86_64-gp2 (ami-0bbc25e23a7640b9b) Our production ami on which we first encountered the problem: amzn-ami-hvm-2016.03.3.x86_64-gp2 (ami-f9dd458a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Sedor [ 10/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks axiodis; Can you please provide the AMI ID you see this behavior with? (e.g., ami-XXXXXXXXXXX) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 09/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have tried again on a new standalone mongoDB server on aws and it gives the same error. MOngoDB repo:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 04/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes i can confirm:
Also the mogo we are using is a replicaSet as you can see running on amazon ec2 instances.
Our replicaSet is basic configuration made from 2 EC2 instances (primary and secondary) on which the data is written and 1 arbiter. I have also tested these commands on a local replicaSet which have been set up using docker and this docker [file|http://37yonub.ru/articles/mongo-replica-set-docker-localhost] and it worked perfectly. Given the fact that i encounter this problem only on the mongoDB running on amazon is there a possibility that the problem can be caused by the amazon operating system? A missing dependency or something else? If yes how can i check this? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Sedor [ 03/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Strangely I am not able to reproduce this by pasting the commands you provided:
"mongo --version" is providing the version of the shell itself. Can you confirm the "db.version()" from the shell? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 01/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
More info I managed to reproduce the problem in our mongoDB shell and I have searched the log and nothing about the agg operation showed.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexandru Martin [ 29/Jun/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi i have tried again on a local mongoDB and it works as it works for you. I don't have access to the database with the problem until monday, but i promise that on monday i will give you all the info i can. Please keep the issue open.
Local test:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Sedor [ 28/Jun/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi axiodis. I am not able to reproduce the issue you've reported "Etc/GMT+7" seems to be acceptable input both as a string to the $project stage and as a reference to a string within documents.
Can you provide more information about how this query is being executed? Or, are you able to reproduce in the MongoDB shell connected to your own database? |