在使用pymongo的Flask中,我希望在mongodb中以日期格式存储datetime,但是它使用我编写的代码以数组或字符串格式存储
myscript
date_post=time.strftime("%b %d %Y %H:%M:%S %p") # if i store this in mongo
db it stores in string datatype
date_post=time.strptime(date_post,"%b %d %Y %H:%M:%S %p")
# if i store this in mongo db it stores in Array datatype
print(type(date_post))
jd = mongo.db.rest_create_job_add
job_id =jd.insert({'Country':country,'State':state,'City':city,'Spoc_Name':spoc_name,'Spoc_EMP_ID':spoc_empid,'SPOC_Email':spoc_email,'Spoc_Mobile_No':spoc_mobile,'Spoc_Work_or_Direct_No':spoc_workno,
'date_posted':date_post,'band_range':band_range})
在mongodb中,它将date_posted
存储在Array datatype
中,而我需要它以日期格式存储。在
任何帮助将不胜感激
提前谢谢
目前没有回答
相关问题 更多 >
编程相关推荐