Hello, I watched some videos for protecting applications on react or node or nest servers, I need some advice [closed]

scrinshot
Namely, I want to prevent some characters from being added to the mongo database, please look at the screenshot, I used NotContaines for this, but it doesn’t look good, is it possible to do it differently and is it worth doing this at all?

Please advise, I’m just learning now