summaryrefslogtreecommitdiff
path: root/jstests/indexc.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-07-01 12:01:11 -0400
committerEliot Horowitz <eliot@10gen.com>2009-07-01 12:01:11 -0400
commit482c31eb4bf5bbfe626373b52abcdd0387325787 (patch)
tree5ab9e06af55056d5d4aade6e8db1559d5f18ea26 /jstests/indexc.js
parent9ea397a1314b3ad6dd96cebde7d21086f243a2c2 (diff)
downloadmongo-482c31eb4bf5bbfe626373b52abcdd0387325787.tar.gz
test for broken multi-key issue
Diffstat (limited to 'jstests/indexc.js')
-rw-r--r--jstests/indexc.js19
1 files changed, 19 insertions, 0 deletions
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" );