-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:SLES 11
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When stored ISODate() values are read through pymongo, the tzinfo is lost gets returned as naive ones.
pymongo version is 2.7.1
For example:
bhargavi@vvaradhan-lap:~/pymongo> python
Python 2.6.8 (unknown, Sep 27 2013, 16:07:59)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from dateutil.parser import *
>>> from pymongo import *
>>> my_datetime=parse("2014-12-12T20:34:44.084Z")
>>> client = MongoClient ('vvaradhan-lap.work', 27087)
>>> client.pymongotest.datetest.insert(
)
ObjectId('54befb57a9d5455748dc31ec')
>>> client.pymongotest.datetest.find_one()
>>> print my_datetime
2014-12-12 20:34:44.084000+00:00
>>> record=client.pymongotest.datetest.find_one()
>>> dt = record['dt']
>>> print dt.tzinfo
None
>>> print my_datetime.tzinfo
tzutc()
>>>
When data is sync'ed or pushed to another in pipeline, the tzinfo is lost and results in time being adjusted to varying degrees of offset based on the geo locations from where the data is viewed.
https://jira.mongodb.org/browse/PYTHON-125 - has a commit that mentions that connections are now tzaware, but in the above example, it doesn't.
https://jira.mongodb.org/browse/PYTHON-6 - can be related too.