Browse files

SERVER-2831 test/demonstration of current behavior

  • Loading branch information...
1 parent 9bb7936 commit 8004154cda5556e326bf97e14f847032fe3ef3ec @astaple astaple committed Mar 24, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 jstests/orh.js
View
17 jstests/orh.js
@@ -0,0 +1,17 @@
+// SERVER-2831 Demonstration of sparse index matching semantics in a multi index $or query.
+
+t = db.jstests_orh;
+t.drop();
+
+t.ensureIndex( {a:1}, {sparse:true} );
+t.ensureIndex( {b:1,a:1} );
+
+t.remove();
+t.save( {b:2} );
+assert.eq( 0, t.count( {a:null} ) );
+assert.eq( 1, t.count( {b:2,a:null} ) );
+
+assert.eq( 1, t.count( {$or:[{b:2,a:null},{a:null}]} ) );
+
+// Is this desired?
+assert.eq( 0, t.count( {$or:[{a:null},{b:2,a:null}]} ) );

0 comments on commit 8004154

Please sign in to comment.