# Documents & BSON — MongoDB

Source: https://www.geekswithgeeks.com/en/mongodb/mongo-documents

> The basic unit of data — a JSON-like object stored as BSON.

## What is a document?

A **document** is a set of key-value pairs, similar to a JSON object. Values can be strings, numbers, arrays, or even nested documents.

## An example document

Notice the nested `address` object and the `tags` array — both live inside one document.

```javascript
{
  name: "Ada Lovelace",
  age: 36,
  address: { city: "London", zip: "SW1A" },
  tags: ["mathematician", "writer"]
}
```

## BSON adds more types

MongoDB stores documents as **BSON** (Binary JSON) — a superset of JSON with extra types like `Date`, `ObjectId`, and distinct `int32`/`int64`/`double`.
