summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-24 15:32:13 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-24 15:32:13 -0400
commit9c1d0e2313a97aae76f31818a7d4b123f3b83635 (patch)
treeb148220502e9600a5c00b2610a6c4e7ed9fcbf07
parent567c2bad85457043ec13db6c4db9b14c59898df2 (diff)
downloadmongo-9c1d0e2313a97aae76f31818a7d4b123f3b83635.tar.gz
test for SERVER-251
-rw-r--r--jstests/regex4.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/regex4.js b/jstests/regex4.js
new file mode 100644
index 00000000000..568c9375a08
--- /dev/null
+++ b/jstests/regex4.js
@@ -0,0 +1,18 @@
+
+t = db.regex3;
+t.drop();
+
+t.save( { name : "eliot" } );
+t.save( { name : "emily" } );
+t.save( { name : "bob" } );
+t.save( { name : "aaron" } );
+
+assert.eq( 2 , t.find( { name : /^e.*/ } ).count() , "no index count" );
+assert.eq( 4 , t.find( { name : /^e.*/ } ).explain().nscanned , "no index explain" );
+//assert.eq( 2 , t.find( { name : { $ne : /^e.*/ } } ).count() , "no index count ne" ); // SERVER-251
+
+t.ensureIndex( { name : 1 } );
+
+assert.eq( 2 , t.find( { name : /^e.*/ } ).count() , "index count" );
+assert.eq( 2 , t.find( { name : /^e.*/ } ).explain().nscanned , "index explain" ); // SERVER-239
+//assert.eq( 2 , t.find( { name : { $ne : /^e.*/ } } ).count() , "index count ne" ); // SERVER-251