How to Create a Multikey Index?
To create a Multikey Index in MongoDB use the createIndex() method.
Syntax
The syntax to create a Multikey Index is given below:
db.Collection_name.createIndex({filed_name: 1/ -1})
MongoDB Multikey Indexes
Indexes are special data structures that store some information related to the documents such that it becomes easy for MongoDB to find the right data file. They also store the value of a specific field or set of fields, ordered by the value of the field as specified in the index.
MongoDB allows indexing a field that holds an array value by creating an index key for each element in the array, such type of indexing is called Multikey Indexes.