|
Confirmed as a shell issue. There is an issue with the way the shell handles regular expression literals when parsing the input string in order to determine whether or not the input is multi-line. The following additions to BalancedTest (dbshell.cpp) exhibit the issue:
verify(isBalanced("/\\{/"));
|
verify(isBalanced("/\\[/"));
|
verify(isBalanced("/\\(/"));
|
Dan: as a workaround, are you aware of the $regex operator? It should let you run such queries:
> db.foo.find({name: {$regex:"\\("}})
|
{ "_id" : 1, "name" : "(" }
|
Alternatively, you can create a JavaScript regular expression object without using the literal syntax:
> db.foo.find({name: new RegExp("\\(")})
|
{ "_id" : 1, "name" : "(" }
|
Also, apostrophes are not permitted in a [...] character class in a regexp.
Hmm, I'm unable to reproduce this:
> db.foo.find({name: /['abc]/})
|
{ "_id" : 0, "name" : "'" }
|
|