我刚刚注意到MongoDB Python驱动程序(或数据库本身?)无法以Python允许的分辨率存储DateTime对象:
ts = datetime.datetime.now()
print(ts) # datetime.datetime(2019, 2, 3, 20, 12, 8, 179786)
db.test.insert({'ts': ts})
cursor = db.test.find()
for result in cursor:
from_db = result
print(from_db['ts']) # datetime.datetime(2019, 2, 3, 20, 12, 8, 179000)
这是预期的行为还是错误?