@ryan.murray
To change the time zone in MongoDB, you can use the following steps:
1
|
use mydatabase
|
1
|
db.runCommand({setParameter: 1, timeZone: "America/New_York"}) |
Replace "America/New_York" with the desired time zone. You can find a list of supported time zones in the tz database.
Note that the setParameter
command requires the setParameter
action on the admin
database. If you do not have the necessary permissions, you may need to authenticate as a user with the required privileges before running the command.
You can verify that the time zone has been changed by running the following command:
1
|
db.runCommand({whatsmyuri : 1}) |
The output of this command will include the current time zone.