E QUERY [main] SyntaxError:missing:属性id @(shell)之后:5:77
db.users.insert
([{"username":"jruiz"},
{"password":"123456"},
{"email":"jessica_ruiz04@hotmail.com"},
{"users_answers":[{"question": ObjectId("58c38d076677dcee6ed2dba7"),"Alright","postdate": new Date()},
{"question": ObjectId("58c38d8c6677dcee6ed2dba8"),"To find healhty coping skills", "postdate": new Date()},
{"question": ObjectId("58c38da86677dcee6ed2dba9"),"Stress", "cat" :ObjectId("58c38bab610a0365ea9775bd"),"postdate":new Date()},
{"question": ObjectId("58c38ded6677dcee6ed2dbaa"),"3-5 hours","postdate": new Date()},
{"question": ObjectId("58c38e006677dcee6ed2dbab"),"Yes, I have done DBT","level": ObjectId("58c38f8f6677dcee6ed2dbae"),"postdate": new Date()}]},
{"goals_checklist":[{"label":"mindfull skills","status":"completed"}, {"label": ObjectId("58c390cf6677dcee6ed2dbbf"), "status":"incomplete"}]}])
答案 0 :(得分:0)
基本上你缺少一个字段的密钥,这就是它给出错误的原因。
vtxMap
我在这里添加了(*g.vInfo[index].vtxMapLoc) = vtxMap.find(index)
。这将运行,但您的结构仍然是错误的,它将使用db.users.insert([{"username":"jruiz"},{"password":"123456"},{"email":"jessica_ruiz04@hotmail.com"},{"users_answers":[{"question":ObjectId("58c38d076677dcee6ed2dba7"),"missingkey":"Alright","postdate": new Date()},{"question": ObjectId("58c38d8c6677dcee6ed2dba8"),"missingkey":"To find healhty coping skills", "postdate": new Date()},{"question": ObjectId("58c38da86677dcee6ed2dba9"),"missingkey":"Stress", "cat" :ObjectId("58c38bab610a0365ea9775bd"),"postdate":new Date()},{"question": ObjectId("58c38ded6677dcee6ed2dbaa"),"missingkey":"3-5 hours","postdate": new Date()},{"question": ObjectId("58c38e006677dcee6ed2dbab"),"missingkey":"Yes, I have done DBT","level": ObjectId("58c38f8f6677dcee6ed2dbae"),"postdate": new Date()}]},{"goals_checklist":[{"label":"mindfull skills","status":"completed"}, {"label": ObjectId("58c390cf6677dcee6ed2dbbf"), "status":"incomplete"}]}])
,missingkey
等字段名创建5条记录。
我已经格式化了代码:
username
它将创建适当的用户记录。