# Unique and Text Indexes

A unique index makes MongoDB refuse a second document with the same value, such as a customer's email, with a duplicate key error, and a text index lets a search box find products by the words in their names and descriptions with $text.

![Cheat sheet: Unique and Text Indexes](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/82a72d3917aa4febb8ffa3618cd045e0.webp)

- Category: MongoDB
- Level: Journeyman
- Tags: $text, Atlas Search, database, Duplicate Key Error, mongodb, Text Index, Unique Index
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/mongodb-unique-and-text-indexes-cheat-sheet
