我是mundodb的新用nodejs.I想要更新评论数据。这是我的文件
{
"__v": NumberInt(0),
"_id": ObjectId("565443b1172e19d51f98b0ed"),
"address": "tohana",
"comments": [
{
"_id": ObjectId("5654455fe088d89c20736e3c"),
"comment": "good man",
"uemail": "dinesh@gmail.com",
"uname": "dinesh"
},
{
"_id": ObjectId("565445e471dce6ca20705a84"),
"comment": "nice person",
"uemail": "kr@gmail.com",
"uname": "krishan"
},
{
"_id": ObjectId("5654460e7aa73bec2064060e"),
"comment": "bad person",
"uemail": "Rai",
"uname": "Rahul"
}
],
"email": "nishantg@ocodewire.com"▼,
"name": "Nishant"
}
我在前端使用Angular js,在后端使用nodeJs。这是我的代码:
app.post('/commentsSave/:id', function(req, res) {
var id = req.params.id; // userId
var input = JSON.parse(JSON.stringify(req.body)); //commentData
var commentId = input.id; //commentId
var name = input.name;
var email = input.email;
var comment = input.comment
res.send({data:id,data2:input});
})
答案 0 :(得分:1)
checkboxes