I am using node v8.11, not able to delete an item from the object which creates and returns new object from the mongoDB.
Sample response after creating:
{
"name": "",
"device": "",
"session":"",
"_id": "5b7e78c3cc7bca3867bbd1c9",
"createdAt": "2018-08-23T09:05:07.134Z",
"updatedAt": "2018-08-23T09:05:07.134Z",
"__v": 0
}
Trying to remove "_id" from the response like below:
tokens.create(req.body).then(function(session){
delete session._id;
return res.send(session); // _id still exist
});
I have seen the delete is deprecated in ES6, is this case issue? How can I delete an Item, in one line using the key?
deletemight work!!