In this guide, you will update a field in a document.
Time required: 10 minutes
- A connection string to your MongoDB deployment.
- Sample datasets loaded into your cluster.
- An installed MongoDB Driver.
- Data inserted from Insert Data into MongoDB.
In the previous guide, you inserted
documents into the
comets collection. Now, you have a
requirement to update those documents. All fields are in metric
units except for the
radius, which is in imperial.
The following example uses an update document to convert
radius field from the metric system to the imperial system
in all documents.
1 mile = 1.60934 kilometers
If you have completed this guide, you have updated data in MongoDB.
In the next guide, you will delete documents from MongoDB.
See the following resources for more in-depth information about the concepts presented here:
Specify which documents to delete from MongoDB.