python - 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
出于某种原因,尽管在插入日期时间之后,日期时间只显示到日期,而不是整个时间戳。我试图找出原因,因为我想要一个特定的时间标签。
解决方案
推荐阅读
- python - 如何在扩展的 Django 模板中发出 GET 请求
- load-balancing - 带有连接跟踪的 nftables L2 负载平衡
- python - 在命令行中使用 subprocess.Popen() 执行的脚本打印“导出完成”后立即关闭 Blender
- javascript - 如何正确地将两个 crons 放入方法中?
- docker - 限制 docker 可以分配的 CPU 内核总数
- iis - IIS 托管 - 网站要求登录提示
- scikit-learn - scikit-learn 的 Yocto 食谱 (dunfell)
- python - Pandas Resample 不起作用 - 删除重复也不起作用
- reactjs - 我们可以在打字稿中实现反应状态属性的接口吗?
- python - Plotly Dash:将指标标题放在数字的左侧