Mongodb MongoShell:语法错误:缺少:在属性id@(shell)之后:1:137 mongo
试图从mac终端在mongoshell中插入:Mongodb MongoShell:语法错误:缺少:在属性id@(shell)之后:1:137 mongo,mongodb,shell,terminal,syntax-error,database,Mongodb,Shell,Terminal,Syntax Error,Database,试图从mac终端在mongoshell中插入: db.recipe.insert({ "_Title": "newname", "_Ingredients": "newingredients" , "_Instructions": "newinstructions" ," _Time":1,"_Category": "newcategory", "_Author": "newauthor" , "_RecipeVersion": 1}) 给出了错误: Sy
db.recipe.insert({ "_Title": "newname", "_Ingredients":
"newingredients" , "_Instructions": "newinstructions" ,"
_Time":1,"_Category": "newcategory", "_Author": "newauthor" ,
"_RecipeVersion": 1})
给出了错误:
SyntaxError:缺少:在属性id@(shell):1:137之后
不确定我在这里遗漏了什么…您的JSON对象中似乎有不寻常的间距-我只是在我的代码编辑器中格式化了它,清理了间距,它工作了:
db.recipe.insert({
"_Title": "newname",
"_Ingredients": "newingredients" ,
"_Instructions": "newinstructions" ,
"_Time":1,
"_Category": "newcategory",
"_Author": "newauthor",
"_RecipeVersion": 1
})
我不能重复你的错误。我得到
WriteResult({“n插入”:1})
。