Home »
MCQs »
MongoDB MCQs
To create an index, you need to use ___ method of MongoDB
34. To create an index, you need to use ___ method of MongoDB.
- createTable()
- createIndex()
- createdata()
- None of the mentioned above
Answer: B) createIndex()
Explanation:
Indexes aid in the quick and efficient resolution of query requests. In the absence of indexes, MongoDB must scan every document in a collection in order to select the documents that match the search query statement. It is necessary to use the createIndex() method of MongoDB in order to create an index. Indexes are special data structures that are used to store a small portion of a data set in a format that is easy to navigate. It stores the value of a specific field or set of fields, ordered by the value of the field as specified in the index, and it does so in an organized manner.