Example 1 — Sample Data
Imagine three products with a name, price, and draft status.
db.products.insertMany([
{ _id: 1, name: "Mug", price: 20, status: "draft" },
{ _id: 2, name: "Notebook", price: 10, status: "draft" },
{ _id: 3, name: "Bag", price: 40, status: "draft" }
]); How the Data Is Stored in MongoDB
After the insert, MongoDB keeps three documents in products. Run find() to see them:
db.products.find() Read each document like this:
| Field in MongoDB | Example | Plain English |
|---|---|---|
name | "Mug" | Product name |
price | 20 | List price |
status | "draft" | Current listing state |
How It Works
- Insert once.
insertManyadds three product documents toproducts. - Fields stay as written. Price is a number; name and status are strings.
- find() shows the same shape. Ready for
$setnext.

