# Compound Index

*noun*

say it: **“KOM-pownd IN-deks”** **/ˈkɑmpaʊnd ˈɪndɛks/**

A MongoDB index on two or more fields together, used by queries that start from its first field.

## What is **Compound Index**?

A **compound index** covers several fields in order. It helps queries that filter or sort on those fields from the left.

```javascript
db.orders.createIndex({ customerId: 1, placedAt: -1 })
```

## In a sentence

- “The order of the fields in a **compound index** decides which queries it can serve.”
- “A **compound index** on customerId and placedAt serves 'Ana's orders, newest first'.”

Level: Journeyman · [More MongoDB terms at this level](https://www.ask-codey.com/glossary?category=mongodb&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/compound-index
