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)