Tsallaka zuwa abun ciki
Justice Tech School

Compound Indexes

Index several fields in order.

Example
db.orders.createIndex({ status: 1, createdAt: -1 })

Exercise

Two fields.

createIndex({ a: 1, : -1 })

Quiz Test

Does field order matter?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.