Filip Isaksson
Filip Isaksson

Reputation: 11

MongoShell: SyntaxError: missing : after property id @(shell):1:137 mongo

Tried to insert in mongoshell from mac terminal:

    db.recipe.insert({ "_Title": "newname", "_Ingredients": 
    "newingredients" , "_Instructions": "newinstructions" ," 
    _Time":1,"_Category": "newcategory", "_Author": "newauthor" , 
    "_RecipeVersion": 1})

Gave error:

SyntaxError: missing : after property id @(shell):1:137

Not sure what I'm missing here...

Upvotes: 1

Views: 5395

Answers (1)

jkras
jkras

Reputation: 324

There seems to be unusual spacing in your JSON object - I just formatted this in my code editor, cleaned up the spacing and it worked:

db.recipe.insert({ 
  "_Title": "newname", 
  "_Ingredients": "newingredients" , 
  "_Instructions": "newinstructions" ,
  "_Time":1,
  "_Category": "newcategory", 
  "_Author": "newauthor", 
  "_RecipeVersion": 1
})

Upvotes: 1

Related Questions