Which of the following command creates an index, where mobile_no is a field in the collection, employees?

All QuestionsCategory: Data ScienceWhich of the following command creates an index, where mobile_no is a field in the collection, employees?
Anonymous asked 3 years ago

Options:

  1. db.SetIndex({“mobile_no”:1})
  2. employees.SetIndex({“mobile_no”:1})
  3. db.employees.ensureIndex({“mobile_no”:1})
  4. db.employees.SetIndex({“mobile_no”:1})
1 Answers
Anonymous answered 3 years ago

The correct answer is 

  1. db.employees.ensureIndex({“mobile_no”:1})