When a price changes, the barista does not rewrite the latte's card from scratch: he crosses out one line and writes the new one beside it. An update in MongoDB works the same way. It says what to do with the document's fields: set a value, add a number, append an element to a list. It leaves the other fields alone. In SQL `UPDATE …
In this lesson
- Inserting and updating fields
- Operators for arrays
- Insert when nothing is found
- Deleting documents
- What is atomic in MongoDB
- Common mistake
- Key points