问题描述
我正在尝试导入JSON格式的大数据文件.我正在使用
I'm trying to import a large data file in JSON format . I'm using
mongoimport --db verbs --collection de --file "/Users/marcelbraasch/Downloads/de.json"
导入数据.这正在经历,但是,我遇到了以下异常:
to import the data. This is going through, however, I'm getting the following exception:
我已经尝试过这样的组合
I already tried combinations like this
mongoimport -h localhost:27017 -u 'user' -p 'password' --db verbs --collection de --file "/Users/myname/Downloads/de.json"
但没有一个起作用.如果此信息很重要,我的mongo实例正在docker容器中运行.我需要做什么?
but none of it worked. My mongo instance is running in a docker container, if this information matters. What do I need to do?
推荐答案
在此处找到答案.该缺少的关键字是authenticationDatabase
.对我有用的命令是:
Found the answer here. This missing keyword was authenticationDatabase
. The command that worked for me was:
mongoimport --db verbs --collection de --authenticationDatabase admin --username user --password password --drop --file /Users/myname/Downloads/de.json
.
这篇关于如何将数据导入mongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!