I have a scheduled trigger that depends on an index, I would like to ensure that the index exists before running the trigger. I’ve attempted to do it this way:
const collection = context.services.get("mycluster").db("mydb").collection("mycollection");
collection.createIndex({ "StartTime": 1 });
But I am getting an error saying createIndex does not exist. Is there any way to ensure an index exists within a scheduled trigger?