Index Creation Basics
See the below transactions collection.
get Indexes() functions will show all the indices available for a collection.
Let see the output of above statement.
There is already one index for transaction collection. This is because MongoDB creates a unique index on the _id field during the creation of a collection. The _id index prevents clients from inserting two documents with the same value for the _id field. You cannot drop this index on the _id field.
Now let's add an index for cr_dr field;
The result of the index execution is as follows.