python写入mongodb时间字段格式为ISO
#!/usr/bin/env python
#coding=utf-8
import time
from dateutil import parser
from pymongo import MongoClient
now = parser.parse(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
conn = MongoClient("192.168.1.135:28001", maxPoolSize=None)
my_db = conn['db_pushmsg']
my_collection = my_db['tb_time_test'].insert_one({"id":5, "time": now})
浙公网安备 33010602011771号