What are indexes and why do they matter?
Model answer
An index is a data structure that lets MongoDB find documents without scanning the whole collection. Add indexes on fields you filter and sort by, and unique indexes for values like email. Indexes speed reads but cost write time and storage, so use explain() to check queries rather than indexing everything.
Learn this topic
Connect Express to MongoDB with Mongoose in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.
Sign in to add your own answer.