Grokking MongoDB
Vote

0% completed

​

Removing, Matching, and Changing Array Elements

Removing an element by its position, as $pop does, works only when you know where the element sits. To drop every one of Charlie's scores below 90, wherever they appear, an update must select elements by their content instead. The operators here remove elements by value, match one element in a query, and change an element in place.

The examples continue with the users collection from the previous lesson, in the state its updates left. To start from that state, run this setup.

db.users.drop() db.users.insertMany([

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content