connectors icon indicating copy to clipboard operation
connectors copied to clipboard

MongoDB connector - add support for DatetimeMS objects

Open mattnowzari opened this issue 7 months ago • 1 comments

Problem Description

Currently, the MongoDB connector uses the stdlib datetime library to handle datetime objects from the Mongo client. We should expand on this handling to include handling of datetimeMS objects, which is an object that can represent dates that would otherwise be out-of-range for the stdlib datetime library.

See this article here about handling out-of-range datetimes with PyMongo.

Proposed Solution

We should enhance the object serialization of the MongoDB connector to handledatetimeMS objects and not just datetime objects when dealing with dates.

https://github.com/elastic/connectors/blob/ae3f04a2a98f2f3bbea5ada32b65f2a130ef4ac3/connectors/sources/mongo.py#L226-L246

mattnowzari avatar Jun 02 '25 11:06 mattnowzari

Update: a PR is there, but we haven't heard anything from the customer. We can merge it if we're confident enough it's a solid approach in the PR.

artem-shelkovnikov avatar Sep 08 '25 13:09 artem-shelkovnikov