Mongodb - Mongoimport error invalid character

前端 未结 6 2078
时光取名叫无心
时光取名叫无心 2020-12-19 01:35

I tried to import a simple json file using mongoimport and i get the following error

PER-MacBook-Pro:/AJ$ mongoimport --db test --collection samplePM --file         


        
6条回答
  •  清歌不尽
    2020-12-19 02:13

    I was able to get away with using --jsonArray tag, giving the file full path, and modified it adding bracket at the beginning and at the end,

    [{"my":"json","file":"imported"},{"my":"cool","file":"succeeded"}]
    

    mongoimport --db myCoolDb --collection myCoolColl --file /path/to/my/imported/file.json --jsonArray
    

提交回复
热议问题