summaryrefslogtreecommitdiff
path: root/jstests/core/indexl.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/indexl.js')
-rw-r--r--jstests/core/indexl.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/core/indexl.js b/jstests/core/indexl.js
new file mode 100644
index 00000000000..666586db7a7
--- /dev/null
+++ b/jstests/core/indexl.js
@@ -0,0 +1,27 @@
+// Check nonoverlapping $in/$all with multikeys SERVER-2165
+
+t = db.jstests_indexl;
+
+function test(t) {
+ t.save( {a:[1,2]} );
+ assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) );
+ assert.eq( 1, t.count( {a:{$all:[2],$in:[1]}} ) );
+ assert.eq( 1, t.count( {a:{$in:[2],$all:[1]}} ) );
+ assert.eq( 1, t.count( {a:{$in:[1],$all:[2]}} ) );
+ assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) );
+ t.save({a:[3,4]})
+ t.save({a:[2,3]})
+ t.save({a:[1,2,3,4]})
+ assert.eq( 2, t.count( {a:{$in:[2],$all:[1]}} ) );
+ assert.eq( 1, t.count( {a:{$in:[3],$all:[1,2]}} ) );
+ assert.eq( 1, t.count( {a:{$in:[1],$all:[3]}} ) );
+ assert.eq( 2, t.count( {a:{$in:[2,3],$all:[1]}} ) );
+ assert.eq( 1, t.count( {a:{$in:[4],$all:[2,3]}} ) );
+ assert.eq( 3, t.count( {a:{$in:[1,3],$all:[2]}} ) );
+}
+
+t.drop();
+test(t);
+t.drop();
+t.ensureIndex( {a:1} );
+test(t); \ No newline at end of file