gpt4 book ai didi

json - 如何通过mac终端导入json文件到mongo?

转载 作者:可可西里 更新时间:2023-11-01 09:35:02 25 4
gpt4 key购买 nike

我正在使用这个命令

mongoimport --db test --collection bankdata --drop --file bank_data.json --port 27017 --host 127.0.0.1

要导入一个 json 文件,但是当我这样做时,我收到了这条消息

Failed: error unmarshaling bytes on document #0: JSON decoder out of sync - data changing underfoot? 2016-05-24T08:00:31.552-0600 imported 0 documents

最佳答案

您正在尝试导入 json 数组,因此您需要根据文档添加 --jsonArray 选项 https://docs.mongodb.com/manual/reference/program/mongoimport/

mongoimport --jsonArray --db test --collection bankdata --drop --file bank_data.json

关于json - 如何通过mac终端导入json文件到mongo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37415829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com