Last active
December 13, 2015 20:38
-
-
Save davit-khaburdzania/4971620 to your computer and use it in GitHub Desktop.
mongoDB Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## searching with regular expressions | |
you can use regular expressions while searching for something ex: | |
db.airports.find(name: {$regex: "[^\s]paris", $options: "i"}) | |
this regex matches every document in airports collections whichs name start with paris | |
or include whitespace character and then paris. but this will't work as expected because | |
in strings \ character works as escape character so we need to excape it too | |
this will work as expected: | |
db.airports.find(name: {$regex: "[^\\s]paris", $options: "i"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment