As to prohibit the use of regular expression in $regex in MongoDB?

Hi all.

You need to find a match to "text" in the line "very big text".
The operator $regex transactions while in the search text!
After all, if you pass in the desired string value /(.*)/ then there are all in a row.
Simply put, you want to prevent use of the regular season in the query.

How to solve this problem?
July 9th 19 at 11:21
1 answer
July 9th 19 at 11:23
So looking for records by title:
.....................
 if (req.body.search) {
 findObject.title = {
 $regex: "(" + req.body.search + ")" // <- All the rules. I request the regular season and nothing of course is not
};
}

 Model.paginate(findObject, {
 page: page,
 limit: limit
 sort: {createdate: 1},
 }, function (err, result) {
 if (err) {
............................
If I do your request I will .* ( period + asterisk) as I think that there are? )
I'll give a hint - everything! - Urban66 commented on July 9th 19 at 11:26
: hmm... sure. And Angular filter does not show data ))) - Kameron_Hilpert34 commented on July 9th 19 at 11:29

Find more questions by tags MongoDB