In the below example, I am looking for something
that contains “ak” as string.
Query 1: db.customers.find({"name": /.*ak.*/})
Query 2:
db.customers.find({"name": /ak/})
We can also use regex, the example look like
below.
db.customers.find({ "name": { $regex: /ak/i } })
OR
db.customers.find({"name": /^ak/})
OR
db.customers.find({'name': {'$regex': 'ak'}})