See Formatting code and log snippets in posts. It shows how to publish code and data.
Also look at Bulk Edit Document Data from String to Float - #3 by steevej to see why I recommend to do bulk conversion into a temporary collection rather than in situ.
Converting date to string is also a bad idea. The space consideration is the same. Comparing date as string is also slower than date as date. Comparing 2 dates to be the same is a few hardware low-level comparisons. Doing it with string might require up to 10 character per character comparisons when dates are within the same year and month such as 2021-10-13 and 2021-10-14.