1.

If you need to rebuild indexes for a collection you can use the _________ method to rebuild all indexes on a collection in a single operation.(a) db.collection.Index()(b) db.collection.reIndex()(c) db.collection.rebuildIndex()(d) none of the mentionedI had been asked this question during a job interview.My enquiry is from Index Management topic in chapter Index/Indexing Concepts of MongoDB

Answer»

Correct option is (a) db.collection.Index()

EASIEST explanation: This OPERATION DROPS all indexes, INCLUDING the _id index, and then rebuilds all indexes.



Discussion

No Comment Found

Related InterviewSolutions