0
を引っ張るますが、私は、スキーマのマングース
var postSchema = new Schema({
comments: [{
nickName: {type: String, required: true},
comment: {type: String, required: true}
}]
});
を持っている。そして、私はこれを行うには直接的な方法はありませんコメント
Post.findOneAndUpdate({'_id': req.body._id}, {$pull: {'comments': {'_id': req.body._idComment} }},
function(err, data) {
if (err) {
res.send({status:400});
} else {
// how get $pull object if I don't know index of element of array
// data returns all objects
}
});