Indexing
Learn and practice commands to create, delete and get indexes in a MongoDB collection.
We'll cover the following...
Indexing is a fundamental database concept that improves read performance but also adds additional delay on write operations. So, it’s important that we create only meaningful indexes. An important point to keep in mind is that MongoDB supports indexing on embedded documents as well.
Note: The
_id
field, which is the primary field, is indexed by default.
Create index
Below is the syntax of the createIndex
command.