无法导入Mongodb Atlas Cluster中正确集合中的文档

时间:2018-10-27 06:06:44

标签: mongodb mongodb-atlas

我希望在“ node-angular”的“ posts”集合中导入包含3个文档的JSON文件。

enter image description here

我运行了以下命令,并导入了文档;但是,它们被创建为另一个名称空间。

mongoimport --host <primary cluster name> --collection posts --type json --file C:/Users/H182720/Desktop/testcontent.json --jsonArray --authenticationDatabase admin --ssl –username <username> --password <password> 

任何有关如何在“ node-angular”的“ posts”集合中导入JSON文档的指导将不胜感激。

1 个答案:

答案 0 :(得分:1)

 mongoimport --host <primary cluster name> --collection posts 
--type json --file C:/Users/H182720/Desktop/testcontent.json --jsonArray 
--authenticationDatabase admin --ssl –username <username> --password <password>  
--db node-angular

这会将文档导入posts数据库的node-angular集合中。