admin管理员组

文章数量:1410697

with the following code I am getting this error:

SyntaxError: missing } after property list <shell>:3

Does anyone know what I did wrong? The curly braces seem balanced so I am wondering if I made a mistake somewhere else.

db.test.save(
{
     "name":"John Doe"
     "attribute":"false"
     "num1":99
     "num2":85
     "num3"{
            "n1":11
            "n2":9
            "n3":8
            "n4":9
     }
     "num4"{
            "m1":15
            "m2":6
            "m3":5
            "m4":12
     }
}
)

with the following code I am getting this error:

SyntaxError: missing } after property list <shell>:3

Does anyone know what I did wrong? The curly braces seem balanced so I am wondering if I made a mistake somewhere else.

db.test.save(
{
     "name":"John Doe"
     "attribute":"false"
     "num1":99
     "num2":85
     "num3"{
            "n1":11
            "n2":9
            "n3":8
            "n4":9
     }
     "num4"{
            "m1":15
            "m2":6
            "m3":5
            "m4":12
     }
}
)
Share Improve this question asked Feb 8, 2013 at 3:05 dspiegsdspiegs 5682 gold badges9 silver badges26 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Missing colons.

 "num3":{
       ^

 "num4":{
       ^

And also mas.

 "name":"John Doe",
                  ^
 "attribute":"false",
                    ^
 "num3"{
        "n1":11, //mas to separate these object properties too
        "n2":9,
        "n3":8,
        "n4":9
 },
  ^
 //etc

This should execute:

{
     "name":"John Doe",
     "attribute":"false",
     "num1":99,
     "num2":85,
     "num3":{
            "n1":11,
            "n2":9,
            "n3":8,
            "n4":9
     },
     "num4":{
            "m1":15,
            "m2":6,
            "m3":5,
            "m4":12
     }
}

There are also some examples of valid documents in the MongoDB update docs.

本文标签: javascriptError with mongodb Missing quotquot after property listStack Overflow