gpt4 book ai didi

mongodb - mongoimport 期间出错

转载 作者:IT老高 更新时间:2023-10-28 13:14:30 26 4
gpt4 key购买 nike

我有几个有效的 JSON 文档,我尝试将它们导入 mongodb。

{ "Books":
[{ "ISBN":"ISBN-0-13-713526-2",
"Price":85,
"Edition":3,
"Title":"A First Course in Database Systems",
"Authors":[ {"First_Name":"Jeffrey", "Last_Name":"Ullman"},
{"First_Name":"Jennifer", "Last_Name":"Widom"} ] }
,
{ "ISBN":"ISBN-0-13-815504-6",
"Price":100,
"Remark":"Buy this book bundled with 'A First Course' - a great deal!",
"Title":"Database Systems:The Complete Book",
"Authors":[ {"First_Name":"Hector", "Last_Name":"Garcia-Molina"},
{"First_Name":"Jeffrey", "Last_Name":"Ullman"},
{"First_Name":"Jennifer", "Last_Name":"Widom"} ] }],
"Magazines":
[{ "Title":"National Geographic",
"Month":"January",
"Year":2009 }
,
{ "Title":"Newsweek",
"Month":"February",
"Year":2009 },
{"Title": "Newsweek"}]
}

我收到以下错误:

Sun Mar 24 15:23:27 exception:BSON representation of supplied JSON istoo large: Failure parsing JSON string near: "Month":"J Sun Mar 24

15:23:27 exception:BSON representation of supplied JSON is too large:Failure parsing JSON string near: "Year":200 Sun Mar 24 15:28:23

ERROR: encountered 28 errors

有人能说说怎么回事吗?

最佳答案

默认情况下,mongoimport 期望每个文档位于 JSON 文件的单行上。您需要使用您正在使用的格式将 --jsonArray 传递给 mongoimport,或者只需确保单个文档的所有数据都在一行上。

(我按原样保存了您的文件,添加了 --jsonArray, 选项并且效果很好。)

关于mongodb - mongoimport 期间出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15599716/

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