Date fields cannot be saved to DB while DateTime works #47
Unanswered
pavelicious-dev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I'm having troube when trying to save a Document with a basic date field:
last_update: datetime.date = mongoz.Date()
like described https://mongoz.tarsild.io/fields/#dateerror message:
bson.errors.InvalidDocument: cannot encode object: datetime.date(2024, 7, 10), of type: <class 'datetime.date'>
When I change the type to
last_update: datetime.datetime = mongoz.DateTime()
everything works fine.Is this an issue with mongoz or with how MongoDB/BSON handles dates, can we only use DateTime?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions