0

I am searching record with full matching string difference is only a small letter in the string. But the string having ().

"name" : {
    "en" : "Monginis Chocolate Muffins 6 N (150 g Each)",
    "hi" : "",
    "te" : ""
}

Query

db.shop_items.findOne({'name.en':{$regex:'.*\Monginis Chocolate Muffins 6 N (150 g Each).*',$options:'i'}})
3
  • Read the links. Not only does escaping regular expressions have an existing answer here, but with a modern MongoDB you should be able to search case insensitive without even using a regex when you know the exact string which only differs in case. Examples and documentation links are there. Commented May 2, 2018 at 10:42
  • I am not escaping the (), I am directely searching the text but string having the () so record is not coming. Parenthesis are included in the string. It is like a where condition but because of case-senstive I am using regex Commented May 2, 2018 at 11:00
  • You got linked there because parenthesis () are special regex characters. You "must" escape them Commented May 2, 2018 at 11:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.