summaryrefslogtreecommitdiff
path: root/jstests/core/in8.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/in8.js')
-rw-r--r--jstests/core/in8.js33
1 files changed, 14 insertions, 19 deletions
diff --git a/jstests/core/in8.js b/jstests/core/in8.js
index 5e7e587629f..be2a696f7c3 100644
--- a/jstests/core/in8.js
+++ b/jstests/core/in8.js
@@ -1,23 +1,18 @@
-// SERVER-2829 Test arrays matching themselves within a $in expression.
+// Test $in regular expressions with overlapping index bounds. SERVER-4677
-t = db.jstests_in8;
-t.drop();
+t = db.jstests_inb;
+t.drop();
-t.save( {key: [1]} );
-t.save( {key: ['1']} );
-t.save( {key: [[2]]} );
+function checkResults( query ) {
+ assert.eq( 4, t.count( query ) );
+ assert.eq( 4, t.find( query ).itcount() );
+}
-function doTest() {
- assert.eq( 1, t.count( {key:[1]} ) );
- assert.eq( 1, t.count( {key:{$in:[[1]]}} ) );
- assert.eq( 1, t.count( {key:{$in:[[1]],$ne:[2]}} ) );
- assert.eq( 1, t.count( {key:{$in:[['1']],$type:2}} ) );
- assert.eq( 1, t.count( {key:['1']} ) );
- assert.eq( 1, t.count( {key:{$in:[['1']]}} ) );
- assert.eq( 1, t.count( {key:[2]} ) );
- assert.eq( 1, t.count( {key:{$in:[[2]]}} ) );
-}
+t.ensureIndex( {x:1} );
+t.save( {x:'aa'} );
+t.save( {x:'ab'} );
+t.save( {x:'ac'} );
+t.save( {x:'ad'} );
-doTest();
-t.ensureIndex( {key:1} );
-doTest();
+checkResults( {x:{$in:[/^a/,/^ab/]}} );
+checkResults( {x:{$in:[/^ab/,/^a/]}} );