summaryrefslogtreecommitdiff
path: root/jstests/regex_embed1.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-22 13:37:56 -0400
committerEliot Horowitz <eliot@10gen.com>2010-03-22 13:37:56 -0400
commit4aea2b8ca54ac62f57fdb38897c56bf590ee315b (patch)
treebdbe3bdb65afc5c2567ace7243170530d80bc93b /jstests/regex_embed1.js
parentfd7616631bbbd8317449b5e093890b326d026492 (diff)
downloadmongo-4aea2b8ca54ac62f57fdb38897c56bf590ee315b.tar.gz
fix a.0.x for regex SERVER-799
Diffstat (limited to 'jstests/regex_embed1.js')
-rw-r--r--jstests/regex_embed1.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/regex_embed1.js b/jstests/regex_embed1.js
new file mode 100644
index 00000000000..61b1b9a14f6
--- /dev/null
+++ b/jstests/regex_embed1.js
@@ -0,0 +1,25 @@
+
+t = db.regex_embed1
+
+t.drop()
+
+t.insert( { _id : 1 , a : [ { x : "abc" } , { x : "def" } ] } )
+t.insert( { _id : 2 , a : [ { x : "ab" } , { x : "de" } ] } )
+t.insert( { _id : 3 , a : [ { x : "ab" } , { x : "de" } , { x : "abc" } ] } )
+
+function test( m ){
+ assert.eq( 3 , t.find().itcount() , m + "1" );
+ assert.eq( 2 , t.find( { "a.x" : "abc" } ).itcount() , m + "2" );
+ assert.eq( 2 , t.find( { "a.x" : /.*abc.*/ } ).itcount() , m + "3" );
+
+ assert.eq( 1 , t.find( { "a.0.x" : "abc" } ).itcount() , m + "4" );
+ assert.eq( 1 , t.find( { "a.0.x" : /abc/ } ).itcount() , m + "5" );
+}
+
+test( "A" );
+
+t.ensureIndex( { "a.x" : 1 } )
+test( "B" );
+
+
+