the-magical-marvels-of-mongodb-slides
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Removing Values From an Array<br />
The $pull operator will remove any instance <strong>of</strong> a value from an array.<br />
Name:<br />
“Shrink…”<br />
Vendor:<br />
“Kettle…”<br />
Categories...<br />
...<br />
"categories": ["tasty", "budget"]<br />
> db.potions.update(<br />
{"name": "Shrinking"},<br />
{"$pull": {"categories": "tasty"}})<br />
Result<br />
"categories": ["budget"]<br />
If value isn’t unique, <strong>the</strong>n all instances<br />
will be removed from <strong>the</strong> array.