我有這些MongoDB文檔。在JSON中:使用mongoimport將日期(ISODate)導入MongoDB
{
"attString":"hello World0",
"attInt":0,
"attDate":new Date("1990-7-20")
}
如何使用mongoimport
將此文檔導入到MongoDB中?我與attDate字段有問題。
這是MongoDB的外殼通知:
失敗:對文件#1錯誤拆封字節:意外ISODate 格式
我有這些MongoDB文檔。在JSON中:使用mongoimport將日期(ISODate)導入MongoDB
{
"attString":"hello World0",
"attInt":0,
"attDate":new Date("1990-7-20")
}
如何使用mongoimport
將此文檔導入到MongoDB中?我與attDate字段有問題。
這是MongoDB的外殼通知:
失敗:對文件#1錯誤拆封字節:意外ISODate 格式
你必須改變你的日期格式JSON
{"attString":"hello World0","attInt":0,"attDate":ISODate("2013-11-20T23:32:18Z")}
OR
{"attString":"hello World0","attInt":0,"attDate":{$date:"2013-11-20T23:32:18Z"}}
希望這將有助於
完美,謝謝。 – DistribuzioneGaussiana
'$ date'爲我工作,'ISODate'沒有 - 謝謝! – CodingIntrigue
我發現這是因爲我遇到類似的錯誤。我發現MongodDB 3.4支持'ISODate',但不支持2.6。 '$ date'在兩者都支持。 –
的可能的複製[JSON文件Mongoimport(http://stackoverflow.com/questions/15171622/mongoimport-of-json-file) – Pio