$push $pop mongodb code example
Example: how pop in mongoose
exports.destroyLink = function(req, res) {
Node.findByIdAndUpdate(
req.params.id, { $pull: { "configuration.links": { _id: req.params.linkId } } }, { safe: true, upsert: true },
function(err, node) {
if (err) { return handleError(res, err); }
return res.status(200).json(node.configuration.links);
});
};