gpt4 book ai didi

json - 将 JSON 文件导入 mongoDB 时出错

转载 作者:可可西里 更新时间:2023-11-01 10:02:50 27 4
gpt4 key购买 nike

我尝试使用此命令将 JSON 文件导入 mongo db。

mongoimport --db test --collection workouts --type json --file /Users/ivanerlic/Documents/Programming/Projects/fitness-app/workouts/4Days/45Min/intermediate/gainMuscle/workout.json

但是我收到这条消息:

connected to: localhost
Failed: error processing document #1: invalid character ',' after object key
imported 0 documents

在搜索那个“,”一个小时后,我找不到它。

这是我的 JSON 文件:

{
"days": 4,
"minutes": 45,
"experience": "intermediate",
"goal": "gain muscle",
"workout": {
"day1": {
"rest": false,
"group": "Chest",
"exerciseCount": 4,
"exercise1": {
"name": "Bench Press",
"sets": 4,
"reps": 8
},
"exercise2": {
"name": "Incline Dumbbell Press",
"sets": 4,
"reps": 10
},
"exercise3": {
"name": "Incline Dumbbell Fly",
"sets": 4,
"reps": 15
},
"exercise4": {
"name": "Cable Fly",
"sets": 3,
"reps": 15
}
},
"day2": {
"rest": true
},
"day3": {
"rest": false,
"group": "Back",
"exerciseCount": 4,
"exercise1": {
"name": "Lat Pulldown",
"sets": 4,
"reps": 12
},
"exercise2": {
"name": "Bent-over Row",
"sets": 4,
"reps": 8
},
"exercise3": {
"name": "T-bar Row",
"sets": 4,
"reps": 10
},
"exercise4": {
"name": "One-arm Dumbbell Row",
"sets": 4,
"reps": 10
}
},
"day4": {
"rest": true
},
"day5": {
"rest": false,
"group": "Shoulders and Arms",
"exerciseCount": 5,
"exercise1": {
"name": "Military Press",
"sets": 4,
"reps": 8
},
"exercise2": {
"name": "Lateral Raise",
"sets": 3,
"reps": 10
},
"exercise3": {
"name": "Rear Shoulder Fly",
"sets": 3,
"reps": 12
},
"exercise4": {
"name": "Dumbbell Curl",
"sets": 3,
"reps": 12
},
"exercise5": {
"name": "Rope Pushdown",
"sets": 3,
"reps": 12
}
},
"day6": {
"rest": false,
"group": "Legs",
"exerciseCount": 5,
"exercise1": {
"name": "Military Press",
"sets": 4,
"reps": 8
},
"exercise2": {
"name": "Lateral Raise",
"sets": 3,
"reps": 10
},
"exercise3": {
"name": "Rear Shoulder Fly",
"sets": 3,
"reps": 12
},
"exercise4": {
"name": "Dumbbell Curl",
"sets": 3,
"reps": 12
},
"exercise5": {
"name": "Rope Pushdown",
"sets": 3,
"reps": 12
}
},
"day7", {
"rest": true
}
}
}

谁能帮我找出错误。谢谢!

最佳答案

看看day7

"day7", {
"rest": true
}

应该是

"day7": {
"rest": true
}

关于json - 将 JSON 文件导入 mongoDB 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39328080/

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