From 482c31eb4bf5bbfe626373b52abcdd0387325787 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Wed, 1 Jul 2009 12:01:11 -0400 Subject: test for broken multi-key issue --- jstests/indexc.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 jstests/indexc.js (limited to 'jstests/indexc.js') diff --git a/jstests/indexc.js b/jstests/indexc.js new file mode 100644 index 00000000000..d7c218b1969 --- /dev/null +++ b/jstests/indexc.js @@ -0,0 +1,19 @@ + +t = db.indexc; +t.drop(); + +for ( var i=1; i<100; i++ ){ + var d = new Date( ( new Date() ).getTime() + i ); + t.save( { a : i , ts : d , cats : [ i , i + 1 , i + 2 ] } ); + if ( i == 51 ) + mid = d; +} + +assert.eq( 50 , t.find( { ts : { $lt : mid } } ).itcount() , "A" ); +assert.eq( 50 , t.find( { ts : { $lt : mid } } ).sort( { ts : 1 } ).itcount() , "B" ); + +t.ensureIndex( { ts : 1 , cats : 1 } ); + +// multi-key bug +//assert.eq( 50 , t.find( { ts : { $lt : mid } } ).itcount() , "C" ); +//assert.eq( 50 , t.find( { ts : { $lt : mid } } ).sort( { ts : 1 } ).itcount() , "D" ); -- cgit v1.2.1