MongoDB user entry
Controllers code:
module.exports.deleteIncome = (params) => {
return User.findById(params.userId) // I went to the user here
.then((user, err) => {
if(err) return false
user.incomeRecords.remove( "_id": "{params.incomeRecordId}" ) // my delete income record syntax
return user.save()
.then((updateUser, err) => {
return(err) ? false : true
})
})
}
Here's my code, it's not working
Please see the pic i provided
I want to delete the specific income record inside the user's array incomeRecords
Please help thanks =)