Question: Assuming you have customers collection with a firstName and lastName field, which is the correct MongoDB shell command to create an index on lastName, then firstName both ascending?

  1. `db.customers.createIndex("lastName, firstName, ASC")`
  2. `db.customers.addIndex({lastName:"ASC", firstName: "ASC"})`
  3. `db.customers.newIndex({lastName:1, firstName:1})`
  4. `db.customers.createIndex({lastName:1, firstName: 1})`

Answer: The correct answer of the above question is Option D:`db.customers.createIndex({lastName:1, firstName: 1})`