Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

Is there any operator, which allows me to check, if the value of a field contains a certain string?

Something in this way:

db.users.findOne({$contains:{"username":"son"}})

1 Answer

0 votes
by (11.7k points)

This can be done by following code:

db.users.findOne({"username" : {$regex : ".*son.*"}});

Browse Categories

...