Click here to Skip to main content
15,867,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I would like to remove dynamically a field from a mongoose document/

What I have tried:

I am using
$unset
and when I type the value
"cars.BMW"
it works. But when I want to pass a parameter, which will be a car brand and then to unset it. I tried
JavaScript
{$unset: {"cars."+brand: " "}}
but the plus sign is unexpected.
Your help will be much appreciated!
Posted
Updated 17-Feb-16 4:34am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900