mongoimport --db dbName --collection collectionName < /Users/pratikjoshi/Desktop/FileName.json --jsonArray
我在 shell 脚本中运行这个命令!
这是我的json文件内容
[
{
"trackingRecordId":5742294,
"longitude":77.126205,
"latitude":28.54711,
"batteryPerc":100,
"speed":0.13,
"createdOnDt":"2016-01-14 00:00:01"
},
{
"trackingRecordId":5742293,
"longitude":72.86727,
"latitude":19.112692,
"batteryPerc":51.82,
"speed":10,
"createdOnDt":"2016-01-13 23:59:59"
}
]