首页 > 解决方案 > MongoDB不保存特定的日期时间

问题描述

我正在使用 pymongo 使用 insert 函数在此处保存在 mongo 集合中插入文档的日期时间:

cur_article['time'] = datetime.datetime.utcnow()

def insert(self, collection, doc):
    collection = self.get_db_instance(collection)
    collection.replace_one({'_id':doc['_id']} , doc, upsert=True)
    return True

出于某种原因,尽管在插入日期时间之后,日期时间只显示到日期,而不是整个时间戳。我试图找出原因,因为我想要一个特定的时间标签。 dbreturn

标签: pythonmongodbpymongo

解决方案


推荐阅读