diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
commit | 5d342a758c6095b4d30aba0750b54f13b8916f51 (patch) | |
tree | 762e9aa84781f5e3b96db2c02d356c29cf0217c0 /jstests/regex6.js | |
parent | cbe2d992e9cd1ea66af9fa91df006106775d3073 (diff) | |
download | mongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz |
Imported Upstream version 2.0.0
Diffstat (limited to 'jstests/regex6.js')
-rw-r--r-- | jstests/regex6.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/jstests/regex6.js b/jstests/regex6.js index 8243313..5414324 100644 --- a/jstests/regex6.js +++ b/jstests/regex6.js @@ -6,6 +6,7 @@ t.save( { name : "eliot" } ); t.save( { name : "emily" } ); t.save( { name : "bob" } ); t.save( { name : "aaron" } ); +t.save( { name : "[with]some?symbols" } ); t.ensureIndex( { name : 1 } ); @@ -14,9 +15,15 @@ assert.eq( 1 , t.find( { name : /^\// } ).explain().nscanned , "index explain 1" assert.eq( 0 , t.find( { name : /^é/ } ).explain().nscanned , "index explain 2" ); assert.eq( 0 , t.find( { name : /^\é/ } ).explain().nscanned , "index explain 3" ); assert.eq( 1 , t.find( { name : /^\./ } ).explain().nscanned , "index explain 4" ); -assert.eq( 4 , t.find( { name : /^./ } ).explain().nscanned , "index explain 5" ); +assert.eq( 5 , t.find( { name : /^./ } ).explain().nscanned , "index explain 5" ); -assert.eq( 4 , t.find( { name : /^\Qblah\E/ } ).explain().nscanned , "index explain 6" ); +// SERVER-2862 +assert.eq( 0 , t.find( { name : /^\Qblah\E/ } ).count() , "index explain 6" ); +assert.eq( 1 , t.find( { name : /^\Qblah\E/ } ).explain().nscanned , "index explain 6" ); +assert.eq( 1 , t.find( { name : /^blah/ } ).explain().nscanned , "index explain 6" ); +assert.eq( 1 , t.find( { name : /^\Q[\Ewi\Qth]some?s\Eym/ } ).count() , "index explain 6" ); +assert.eq( 2 , t.find( { name : /^\Q[\Ewi\Qth]some?s\Eym/ } ).explain().nscanned , "index explain 6" ); +assert.eq( 2 , t.find( { name : /^bob/ } ).explain().nscanned , "index explain 6" ); // proof nscanned == count+1 assert.eq( 1, t.find( { name : { $regex : "^e", $gte: "emily" } } ).explain().nscanned , "ie7" ); assert.eq( 1, t.find( { name : { $gt : "a", $regex: "^emily" } } ).explain().nscanned , "ie7" ); |