I have a question. When inserting or updatingOne in MongoDB, the input time is inserted using new Date(). However, when using new Date(), UTC time is recorded. I live in Korea and I want to set the time zone to Korea. What should I do?
I have a question. When inserting or updatingOne in MongoDB, the input time is inserted using new Date(). However, when using new Date(), UTC time is recorded. I live in Korea and I want to set the time zone to Korea. What should I do?
You can't do that. All times in MongoDB are stored as UTC times.
Usually the client application takes care to display the time as local time. If you need to preserve the input time zone, then you must store it separately in a dedicated field.
Then you can use for example $dateToString to display the time in desired time zone.