From 4aea2b8ca54ac62f57fdb38897c56bf590ee315b Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 22 Mar 2010 13:37:56 -0400 Subject: fix a.0.x for regex SERVER-799 --- jstests/regex_embed1.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 jstests/regex_embed1.js (limited to 'jstests/regex_embed1.js') 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" ); + + + -- cgit v1.2.1