As you can see in the resulting document, you have an object as the value of the fields marks:
{
"_id" : ObjectId("55b38136c645304214249b68"),
"name" : "testing",
"rollnumber" : "12345",
"password" : "testing",
"issuebook" : [],
"marks" : {
"subject" : {
"class1" : 1,
"name" : "math",
"number" : 12,
"garde" : "B"
}
},
"__v" : 0,
"status" : "Active",
"status1" : "Active"
}
So you get an error.
Follow these steps to restore:
db.student.remove({_id: ObjectId("55b38136c645304214249b68")})
db.student.insert({
"_id" : ObjectId("55b38136c645304214249b68"),
"name" : "testing",
"rollnumber" : "12345",
"password" : "testing",
"issuebook" : [],
"marks" : [
{
"subject" : {
"class1" : 1,
"name" : "math",
"number" : 12,
"garde" : "B"
}
}
]
"__v" : 0,
"status" : "Active",
"status1" : "Active"
}
)
source
share