Just do:
user.password = undefined;
instead of:
delete user.password;
and the password property will not appear at the output.
Just do:
user.password = undefined;
instead of:
delete user.password;
and the password property will not appear at the output.