美文网首页
mongodb导入数据错误, cannot decode arr

mongodb导入数据错误, cannot decode arr

作者: 曾經丶記憶的風景 | 来源:发表于2020-05-31 20:45 被阅读0次

MongoDB作为数据库使用时,会将已存在的JSON数据导入,会用到一下命令:

mongoimport -d 数据库名称 -c 集合名称 --file JSON数据地址

但是,可能会在控制台看见报错:cannot decode array into a D

因为你可能导入的数据是一个数组,此时你将--file参数替换为–jsonArray即可,如下:

mongoimport -db 数据库名称 -c 集合名称 --jsonArray JSON文件地址

相关文章

网友评论

      本文标题:mongodb导入数据错误, cannot decode arr

      本文链接:https://www.haomeiwen.com/subject/alwrzhtx.html