summaryrefslogtreecommitdiff
path: root/jstests/indexm.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2011-04-25 11:25:22 -0700
committerAaron <aaron@10gen.com>2011-04-25 13:29:51 -0700
commit06b905b0fd11021444ba964d70ee012b81684bd2 (patch)
tree809a752c13c5fdd551f1b53a55e7e07b5775694c /jstests/indexm.js
parent71735ebc866ea664f16543e6ad8dca66c5cb8fe2 (diff)
downloadmongo-06b905b0fd11021444ba964d70ee012b81684bd2.tar.gz
SERVER-2303 test
Diffstat (limited to 'jstests/indexm.js')
-rw-r--r--jstests/indexm.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/jstests/indexm.js b/jstests/indexm.js
new file mode 100644
index 00000000000..e0cb505a682
--- /dev/null
+++ b/jstests/indexm.js
@@ -0,0 +1,31 @@
+// Check proper range combinations with or clauses overlapping non or portion of query SERVER-2302
+
+t = db.jstests_indexm;
+t.drop();
+
+t.save( { a : [ { x : 1 } , { x : 2 } , { x : 3 } , { x : 4 } ] } )
+
+function test(){
+ assert.eq( 1, t.count(
+ {
+ a : { x : 1 } ,
+ "$or" : [ { a : { x : 2 } } , { a : { x : 3 } } ]
+ }
+ ) );
+}
+
+// The first find will return a result since there isn't an index.
+test();
+
+// Now create an index.
+t.ensureIndex({"a":1});
+test();
+
+// Now create a different index.
+t.dropIndexes();
+t.ensureIndex({"a.x":1});
+test();
+
+// Drop the indexes.
+t.dropIndexes();
+test(); \ No newline at end of file