I want to search values having special characters such as \" $ / . @ > \" in a document.
\" $ / . @ > \"
Lets consider, I\'ve myKey with values like \"test$aus
\"test$aus
You can use this:
db.myCollection.find({myKey:{ $regex:new RegExp('^' + 'test$australia'.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '$', 'i')}})