summaryrefslogtreecommitdiff
path: root/jstests/core/or_inexact.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/or_inexact.js')
-rw-r--r--jstests/core/or_inexact.js52
1 files changed, 26 insertions, 26 deletions
diff --git a/jstests/core/or_inexact.js b/jstests/core/or_inexact.js
index d6a51d66259..0584be98d6d 100644
--- a/jstests/core/or_inexact.js
+++ b/jstests/core/or_inexact.js
@@ -20,7 +20,7 @@ var cursor;
// Case 1: An EXACT predicate and an INEXACT_COVERED
t.drop();
-t.ensureIndex({name: 1});
+t.createIndex({name: 1});
t.insert({_id: 0, name: "thomas"});
t.insert({_id: 1, name: "alexandra"});
cursor = t.find({$or: [{name: "thomas"}, {name: /^alexand(er|ra)/}]});
@@ -28,7 +28,7 @@ assert.eq(2, cursor.itcount(), "case 1");
// Case 2: Two INEXACT_COVERED predicates.
t.drop();
-t.ensureIndex({name: 1});
+t.createIndex({name: 1});
t.insert({_id: 0, name: "thomas"});
t.insert({_id: 1, name: "alexandra"});
cursor = t.find({$or: [{name: /omas/}, {name: /^alexand(er|ra)/}]});
@@ -36,7 +36,7 @@ assert.eq(2, cursor.itcount(), "case 2");
// Case 3: An EXACT, and INEXACT_COVERED, and an INEXACT_FETCH.
t.drop();
-t.ensureIndex({names: 1});
+t.createIndex({names: 1});
t.insert({_id: 0, names: ["thomas", "alexandra"]});
t.insert({_id: 1, names: "frank"});
t.insert({_id: 2, names: "alice"});
@@ -47,7 +47,7 @@ assert.eq(3, cursor.itcount(), "case 3");
// Case 4: Two INEXACT_FETCH.
t.drop();
-t.ensureIndex({names: 1});
+t.createIndex({names: 1});
t.insert({_id: 0, names: ["thomas", "alexandra"]});
t.insert({_id: 1, names: ["frank", "alice"]});
t.insert({_id: 2, names: "frank"});
@@ -58,8 +58,8 @@ assert.eq(2, cursor.itcount(), "case 4");
// Case 5: Two indices. One has EXACT and INEXACT_COVERED. The other
// has EXACT and INEXACT_FETCH.
t.drop();
-t.ensureIndex({first: 1});
-t.ensureIndex({last: 1});
+t.createIndex({first: 1});
+t.createIndex({last: 1});
t.insert({_id: 0, first: "frank", last: "smith"});
t.insert({_id: 1, first: "john", last: "doe"});
t.insert({_id: 2, first: "dave", last: "st"});
@@ -71,7 +71,7 @@ assert.eq(4, cursor.itcount(), "case 5");
// Case 6: Multikey with only EXACT predicates.
t.drop();
-t.ensureIndex({names: 1});
+t.createIndex({names: 1});
t.insert({_id: 0, names: ["david", "dave"]});
t.insert({_id: 1, names: ["joseph", "joe", "joey"]});
cursor = t.find({$or: [{names: "dave"}, {names: "joe"}]});
@@ -79,7 +79,7 @@ assert.eq(2, cursor.itcount(), "case 6");
// Case 7: Multikey with EXACT and INEXACT_COVERED.
t.drop();
-t.ensureIndex({names: 1});
+t.createIndex({names: 1});
t.insert({_id: 0, names: ["david", "dave"]});
t.insert({_id: 1, names: ["joseph", "joe", "joey"]});
cursor = t.find({$or: [{names: "dave"}, {names: /joe/}]});
@@ -87,8 +87,8 @@ assert.eq(2, cursor.itcount(), "case 7");
// Case 8: Text with EXACT.
t.drop();
-t.ensureIndex({pre: 1, names: "text"});
-t.ensureIndex({other: 1});
+t.createIndex({pre: 1, names: "text"});
+t.createIndex({other: 1});
t.insert({_id: 0, pre: 3, names: "david dave", other: 1});
t.insert({_id: 1, pre: 4, names: "joseph joe joey", other: 2});
cursor = t.find({$or: [{$text: {$search: "dave"}, pre: 3}, {other: 2}]});
@@ -96,8 +96,8 @@ assert.eq(2, cursor.itcount(), "case 8");
// Case 9: Text with INEXACT_COVERED.
t.drop();
-t.ensureIndex({pre: 1, names: "text"});
-t.ensureIndex({other: 1});
+t.createIndex({pre: 1, names: "text"});
+t.createIndex({other: 1});
t.insert({_id: 0, pre: 3, names: "david dave", other: "foo"});
t.insert({_id: 1, pre: 5, names: "david dave", other: "foo"});
t.insert({_id: 2, pre: 4, names: "joseph joe joey", other: "bar"});
@@ -106,8 +106,8 @@ assert.eq(2, cursor.itcount(), "case 9");
// Case 10: Text requiring filter with INEXACT_COVERED.
t.drop();
-t.ensureIndex({pre: 1, names: "text"});
-t.ensureIndex({other: 1});
+t.createIndex({pre: 1, names: "text"});
+t.createIndex({other: 1});
t.insert({_id: 0, pre: 3, names: "david dave", other: "foo"});
t.insert({_id: 1, pre: 3, names: "david dave", other: "foo"});
t.insert({_id: 2, pre: 4, names: "joseph joe joey", other: "bar"});
@@ -116,7 +116,7 @@ assert.eq(3, cursor.itcount(), "case 10");
// Case 11: GEO with non-geo, same index, 2dsphere.
t.drop();
-t.ensureIndex({pre: 1, loc: "2dsphere"});
+t.createIndex({pre: 1, loc: "2dsphere"});
t.insert({_id: 0, pre: 3, loc: {type: "Point", coordinates: [40, 5]}});
t.insert({_id: 1, pre: 4, loc: {type: "Point", coordinates: [0, 0]}});
cursor = t.find({
@@ -149,7 +149,7 @@ assert.eq(2, cursor.itcount(), "case 11");
// Case 12: GEO with non-geo, same index, 2d.
t.drop();
-t.ensureIndex({pre: 1, loc: "2d"});
+t.createIndex({pre: 1, loc: "2d"});
t.insert({_id: 0, pre: 3, loc: {type: "Point", coordinates: [40, 5]}});
t.insert({_id: 1, pre: 4, loc: {type: "Point", coordinates: [0, 0]}});
cursor = t.find({
@@ -182,7 +182,7 @@ assert.eq(2, cursor.itcount(), "case 12");
// Case 13: $elemMatch object.
t.drop();
-t.ensureIndex({"a.b": 1});
+t.createIndex({"a.b": 1});
t.insert({_id: 0, a: [{b: 1}, {b: 2}]});
t.insert({_id: 1, a: [{b: 3}, {b: 4}]});
cursor = t.find({$or: [{a: {$elemMatch: {b: {$lte: 1}}}}, {a: {$elemMatch: {b: {$gte: 4}}}}]});
@@ -190,7 +190,7 @@ assert.eq(2, cursor.itcount(), "case 13");
// Case 14: $elemMatch object, below an AND.
t.drop();
-t.ensureIndex({"a.b": 1});
+t.createIndex({"a.b": 1});
t.insert({_id: 0, a: [{b: 1}, {b: 2}]});
t.insert({_id: 1, a: [{b: 2}, {b: 4}]});
cursor =
@@ -199,7 +199,7 @@ assert.eq(2, cursor.itcount(), "case 14");
// Case 15: $or below $elemMatch.
t.drop();
-t.ensureIndex({"a.b": 1});
+t.createIndex({"a.b": 1});
t.insert({_id: 0, a: [{b: 1}, {b: 2}]});
t.insert({_id: 1, a: [{b: 2}, {b: 4}]});
t.insert({_id: 2, a: {b: 4}});
@@ -208,7 +208,7 @@ assert.eq(2, cursor.itcount(), "case 15");
// Case 16: $or below $elemMatch with INEXACT_COVERED.
t.drop();
-t.ensureIndex({"a.b": 1});
+t.createIndex({"a.b": 1});
t.insert({_id: 0, a: [{b: "x"}, {b: "y"}]});
t.insert({_id: 1, a: [{b: "y"}, {b: ["y", "z"]}]});
t.insert({_id: 2, a: {b: ["y", "z"]}});
@@ -217,7 +217,7 @@ assert.eq(2, cursor.itcount(), "case 16");
// Case 17: case from SERVER-14030.
t.drop();
-t.ensureIndex({number: 1});
+t.createIndex({number: 1});
t.insert({number: null, user_id: 1});
t.insert({number: 2, user_id: 1});
t.insert({number: 1, user_id: 1});
@@ -226,7 +226,7 @@ assert.eq(3, cursor.itcount(), "case 17");
// Case 18: $in with EXACT and INEXACT_COVERED.
t.drop();
-t.ensureIndex({name: 1});
+t.createIndex({name: 1});
t.insert({_id: 0, name: "thomas"});
t.insert({_id: 1, name: "alexandra"});
cursor = t.find({name: {$in: ["thomas", /^alexand(er|ra)/]}});
@@ -234,7 +234,7 @@ assert.eq(2, cursor.itcount(), "case 18");
// Case 19: $in with EXACT, INEXACT_COVERED, and INEXACT_FETCH.
t.drop();
-t.ensureIndex({name: 1});
+t.createIndex({name: 1});
t.insert({_id: 0, name: "thomas"});
t.insert({_id: 1, name: "alexandra"});
t.insert({_id: 2});
@@ -243,8 +243,8 @@ assert.eq(3, cursor.itcount(), "case 19");
// Case 20: $in with EXACT, INEXACT_COVERED, and INEXACT_FETCH, two indices.
t.drop();
-t.ensureIndex({a: 1});
-t.ensureIndex({b: 1});
+t.createIndex({a: 1});
+t.createIndex({b: 1});
t.insert({_id: 0, a: "x", b: "y"});
t.insert({_id: 1, a: "z", b: "z"});
t.insert({_id: 2});
@@ -256,7 +256,7 @@ assert.eq(5, cursor.itcount(), "case 19");
// Case 21: two $geoWithin that collapse to a single GEO index scan.
t.drop();
-t.ensureIndex({loc: "2dsphere"});
+t.createIndex({loc: "2dsphere"});
t.insert({_id: 0, loc: {type: "Point", coordinates: [40, 5]}});
t.insert({_id: 1, loc: {type: "Point", coordinates: [0, 0]}});
cursor = t.find({