Thuta Learning
MongoDB
BasicData & DatabasesIntermediate

Documents & Collections

MongoDBLesson 4

The two core building blocks of MongoDB are Collections and Documents.

• Document: a BSON object made up of field-and-value pairs. It's the equivalent of a row in a SQL table.

• Collection: a group of documents bundled together. It's the equivalent of a table in a SQL database.

javascript
// We will use a collection named 'inventory' for our examples.
// Sample documents:
{ "item": "journal", "qty": 25, "tags": ["blank", "red"] }
{ "item": "notebook", "qty": 50, "tags": ["red", "blank"] }
{ "item": "paper", "qty": 100, "tags": ["white", "blank"] }
You should see
(We'll be using this inventory collection throughout these lessons)

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Documents & Collections | Thuta Learning