I see. Could you let me know which mongo driver you are using?
Try this to see it work
const param1 = "kaplan" // You might change this to be dynamic from query string
const docs = mycollection.find({
"dt_name": {
"$regex": param1, "$options": "i"
}
});
const data = await docs.toArray();
console.log("Doc Len", data.length);
return data;