The createIndex method in MongoDB builds an index on specified fields of a collection. You call createIndex on a collection with a specification object like { age: 1 } where 1 means ascending order. MongoDB scans all documents in the collection and creates index entries for the specified field. After building and storing the index, queries that filter or sort by that field become faster. The process involves starting with the collection, calling createIndex, building the index structure, storing it, and then using it for queries. Variables like the collection name, index specification, index entries, and index storage status change step-by-step during execution. Understanding the meaning of 1 and -1 for index order and knowing that the index is only usable after creation finishes are key points. This visual trace helps beginners see how createIndex works internally and when it affects query performance.