I am trying to do a case-insensitive search using Regex - the documentation gives examples with literal strings but I am trying this using a variable instead. This search works but only with matching case - how can I make it case insensitive?
exports=function (payload) {
const query={"dt_name" : {'$regex':"^"+payload.query.testparam.toString()+"$"}};
const mongodb=context.services.get("mongodb-atlas");
const mycollection = mongodb.db("dt3_api").collection("LCP Production");
return mycollection.find(query).limit(10).toArray();
};