Back to gallery Indexes on
7
Indexes
Create and list secondary indexes at runtime.
Live
DB.createIndex / listIndexes What an index does
An index is a sorted lookup structure the engine maintains alongside the collection. A query filtering or sorting oncategory can jump straight to the matching rows
instead of scanning every document — turning an O(n) scan into an O(log n) seek. unique additionally rejects duplicate values.Index ops
No output yet — run the demo above.
Indexes on demo_products
7idx_kitchensinklabertasch_demo_products_auto_name documentname: 1
idx_kitchensinklabertasch_demo_products_auto_price documentprice: 1
idx_kitchensinklabertasch_demo_products_auto_stock documentstock: 1
idx_kitchensinklabertasch_demo_products_category documentcategory: 1
idx_kitchensinklabertasch_demo_products_category_desc documentcategory: -1
idx_kitchensinklabertasch_demo_products_category_price documentcategory: 1, price: 1
idx_kitchensinklabertasch_demo_products_sku_uniq unique documentsku: 1