In the movies collection we can see two different types of date type. The
releaased key has ISODate datatype, but the
lastupdated key has a string datatype.
I can convert a date string to a
datetime type and send it to MongoDB. If I retrieve the data, then I’ll get a string as the
I can write
new Date("2017-04-10") in the Mongo Shell.
I created a
pydantic model and use
motor as the mongoDB driver in Python.
However, sending a
datetime dict entry to mongoDB denerate a date string instead of ISODate. How can I create a new date entry with the ISODate type in Python with
Suppose I have a birthday field in my document (time is irrelevant). What is the best way to define the datatype, a date string data type or ISODate?