How to get only certain values from an array?
module.exports.getAll = async function (req, res) {
try {
const cards = await Card.find({})
res.status(200).json(cards)
} catch (e) {
errorHandler(res, e)
}
}
I am currently displaying an array in this form:
[
{
"ncard": "123123",
"name": "sdf",
"lim": "0",
"ost": "0",
"message": " ",
"status": "1",
"_id": "5f030111f5df83755eb65721",
"date": "2020-07-06T10:46:41.001Z",
"__v": 0
},
...
]
But I want to receive in this form:
[
{
"ncard": "123123",
"name": "sdf",
"_id": "5f030111f5df83755eb65721",
"date": "2020-07-06T10:46:41.001Z",
"__v": 0
},
...
]
How can I do that?