I need help passing in a searchTerm from a variable, what is the best way to do this?
const mongoquery = { description: { $in: [ /searchTerm/ ] } };
I attempted it like this initially:
const mongoquery = { description: { $in: [ `/${searchTerm}/` ] } };
However, it did not work as expected because the backticks were included in the string:
{ description: { '$in': [ '/FAB/' ] } }