Date inside object in mongo db does not work with DictField

46 views
Skip to first unread message

Eduardo Rios Corlay

unread,
Mar 9, 2023, 11:11:18 AM3/9/23
to MongoEngine Users
Hello, I have been trying to find a way to make this work, the problem is my mongodb object has a Date as one of the inner elements of an object:

date: {
     type: "dateAdded",
      content: 2022-01-18T21:04:24.810+00:00
}

When defininf the model as (date = DictField() ) I get an error when running a query saying "Object of type datetime is not JSON serializable". I have been trying to find a way to make this work but documentation and online examples do not seem to help me, I tried with EmbeddedDocument, MapField, and so on but I cannot find a correct way to do it or make it work. Any advice?

Reply all
Reply to author
Forward
0 new messages