I have a back-end service developed using .Net Core 3.1. My backend is connected to MongoDB Atlas. In my DB schema, we have a few “Date” fields. These Date fields are being saved till milliseconds precision in Mongo DB like “yyyy-MM-dd T HH:mm:ss.ffff”.
Now we want to truncate these Date fields and save them only till second precision, NOT milliseconds precision. I tried from backend service by converting date format to “yyyy-MM-dd HH:mm:ss” and sending it to Mongo DB. Mongo DB is still saving till milliseconds precision like “yyyy-MM-dd T HH:mm:ss.0000”, it is saving milliseconds as “0000”
Is it possible to truncate milliseconds precision in Date Fields while saving them in MongoDB?