Question: Which code example completes this statement and creates an index for a MongoDB object named restaurants, sorted ascending by the field name?
- `const results = yield db.table('restaurants').createIndex({"name": 1}, null); return results;`
- `const results = yield db.collection('restaurants').createIndex({"name": 0}, null); return results;`
- `const results = yield db.collection('restaurants').createIndex({"name": 1}, null); return results;`
- `const results = yield db.table('restaurants').createIndex({"name": 0}, null); return results;`
Answer: The correct answer of the above question is Option C:`const results = yield db.collection('restaurants').createIndex({"name": 1}, null); return results;`