Insert Data into MongoDB
In this guide, you will insert data into MongoDB.
Time required: 15 minutes
What You'll Need
A connection string to your MongoDB deployment.
Sample datasets loaded into your cluster.
Insert documents into the
Create and insert three new documents for the
collection. Each document consists of the following
information about the comet:
The official name
The orbital period in years
The radius in miles
The mass in kilograms
If you omit the
_id field, the driver
automatically generates a unique
ObjectId value for the
If you have completed this guide, you have inserted data into MongoDB.
In the next guide, you will learn how to update a field in a document.
See the following resources for more in-depth information about the concepts presented here:
Specify which documents to update and how to update them in MongoDB.