问题描述
Am使用具有定义的字段类型--columnsHaveTypes的mongoimport。当我导入文件时出现错误
失败:在文档#1中为“时间”列键入强制失败,无法解析令牌'2020-09-08T09:41:19.693 + 0300'以键入日期>
我使用以下命令
mongoimport --db main-集合数据--type csv --columnsHaveTypes --fields =“ time.date(2006-01-02),duration.int32(),entry.string()” --file =“ path \ to \ test.csv”
解决方法
2020-09-08T09:41:19.693+0300
不是日期/时间的标准表示,因此mongoimport无法对其进行解析。
https://tools.ietf.org/html/rfc3339#section-5.6将本地偏移量定义为
time-numoffset =(“ +” /“-”)时分“:”时分
您的字符串缺少冒号。 2020-09-08T09:41:19.693+03:00
将被正确解析。