Complete the code to create an ascending index on the field 'age'.
db.collection.createIndex({ age: [1] })In MongoDB, an ascending index is created by specifying 1 as the index direction.
Complete the code to create a descending index on the field 'score'.
db.collection.createIndex({ score: [1] })Descending indexes in MongoDB use -1 as the direction.
Fix the error in the index creation code to specify descending order on 'date'.
db.collection.createIndex({ date: [1] })Descending order requires -1, not 1 or boolean values.
Fill both blanks to create a compound index with 'name' ascending and 'score' descending.
db.collection.createIndex({ name: [1], score: [2] })Compound indexes can mix ascending (1) and descending (-1) directions.
Fill all three blanks to create a compound index with 'category' descending, 'price' ascending, and 'rating' descending.
db.collection.createIndex({ category: [1], price: [2], rating: [3] })Compound indexes can combine ascending (1) and descending (-1) directions as needed.