Conclusion / Learn
MongoDB CRUD Operations: Replace and Delete Documents
In this unit, you learned how to modify query results with MongoDB. Specifically, you:
- Replaced a single document by using
db.collection.replaceOne(). - Updated a field value by using the
$setupdate operator indb.collection.updateOne(). - Added a value to an array by using the
$pushupdate operator indb.collection.updateOne(). - Added a new field value to a document by using the
upsertoption indb.collection.updateOne(). - Found and modified a document by using
db.collection.findAndModify(). - Updated multiple documents by using
db.collection.updateMany(). - Deleted a document by using
db.collection.deleteOne().
Resources
Use the following resources to learn more about modifying query results in MongoDB: