> For the complete documentation index, see [llms.txt](https://docs.bashschool.in/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bashschool.in/v1/javascript/mongodb/working-with-documents.md).

# Working with Documents

#### Inserting Documents

You can insert a single document into a collection using the `insert()` method:

```
db.collectionName.insert({name: "Jane Smith", age: 25, email: "jane@example.com"})
```

To insert multiple documents at once, use the `insertMany()` method:

```
db.collectionName.insertMany([
  {name: "Alice", age: 35, city: "New York"},
  {name: "Bob", age: 28, city: "London"},
  {name: "Charlie", age: 42, city: "Paris"}
])
```

#### Displaying Documents

To retrieve and display documents from a collection, use the `find()` method:

```
db.collectionName.find()
```

This will return all documents in the collection.

You can also format the output for better readability using the `pretty()` method:

```
db.collectionName.find().pretty()
```

#### Displaying Collections

To list all collections in the current database, use the `show collections` command:

```
show collections
```

To view statistics and information about a specific collection, use the `stats()` method:

```
db.collectionName.stats()
```
