In SQL, how to limit the number of rows after ordering it in Oracle DB?
- How-Tos FAQs
- December 16, 2018

We can perform ‘Like’ operations in MongoDB using regular expressions. In fact, regular expressions are more powerful than the Like operator.
Let us consider the following collection:
db = {
"fruits": [
{"name": "apple" },
{ "name": "pineapple" },
{ "name": "orange" },
{ "name": "banana"}
]
}
For Like ‘%apple%’:
db.fruits.find({ name: { $regex: "apple" }})
#Output
apple, pineapple
For Like ‘a%’:
db.fruits.find({ name: { $regex: "^a" }})
#Output
apple
For Like ‘%e’:
db.fruits.find({ name: { $regex: "e$" }})
#Output
apple, pineapple, orange
Up Next:
Read How to convert DATETIME value to VARCHAR value in SQL server?