Local DB vs Atlas: Different field type for dateTime

You are clearly converting native date to string.

So both Atlas and local server should store your createdDateTime in the same string format. It would be a major flaw if they would.

So what ever happens is not related to where the server is running. Most likely the document where createdDateTime is stored in date format have been inserted before the code was changed or are inserted by another piece of code.

By the way it is more efficient to store dates in the date format compared to string. Date takes less space than the string version, date is much faster to compare than string and provides a richer API.