Checking if a field contains a string
I’m looking for an operator, which allows me to check, if the value of a field contains a certain string. Something like: db.users.findOne({$contains:{“username”:”son”}}) Is that possible? 15 s 15 You can do it with the following code. db.users.findOne({“username” : {$regex : “son”}});