mongoimport --db [databaseName] --collection [collectionName] --file [filePath]
[databaseName] => 数据库名
[collectionName] => 集合名
[filePath] => 文件路径
mongoimport --db playground --collection user --file ./test.json
[{
"name": "Alexander",
"author": "Ezharjan",
"isPublished": true
}, {
"name": "Javascript",
"author": "Alexander",
"isPublished": true
}, {
"name": "Javascript",
"author": "Alexander",
"isPublished": true
}, {
"name": "C#",
"author": "Alex",
"isPublished": true
}, {
"name": "C#",
"author": "Ezharjan",
"isPublished": true
}]
mongoimport --db test --collection user --jsonArray ./test.json
作者:艾孜尔江
MongoDB导入数据库异常——Failed: cannot decode array into a D
原文:https://www.cnblogs.com/ezhar/p/13110258.html