summaryrefslogtreecommitdiff
path: root/jstests/core/index_type_change.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/index_type_change.js')
-rw-r--r--jstests/core/index_type_change.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/jstests/core/index_type_change.js b/jstests/core/index_type_change.js
index ad2525fe015..af2671338a2 100644
--- a/jstests/core/index_type_change.js
+++ b/jstests/core/index_type_change.js
@@ -11,32 +11,32 @@
load("jstests/libs/analyze_plan.js"); // For 'isIndexOnly'.
(function() {
- "use strict";
+"use strict";
- var coll = db.index_type_change;
- coll.drop();
- assert.commandWorked(coll.ensureIndex({a: 1}));
+var coll = db.index_type_change;
+coll.drop();
+assert.commandWorked(coll.ensureIndex({a: 1}));
- assert.writeOK(coll.insert({a: 2}));
- assert.eq(1, coll.find({a: {$type: "double"}}).itcount());
+assert.writeOK(coll.insert({a: 2}));
+assert.eq(1, coll.find({a: {$type: "double"}}).itcount());
- var newVal = new NumberLong(2);
- var res = coll.update({}, {a: newVal}); // Replacement update.
- assert.writeOK(res);
- assert.eq(res.nMatched, 1);
- if (coll.getMongo().writeMode() == "commands")
- assert.eq(res.nModified, 1);
+var newVal = new NumberLong(2);
+var res = coll.update({}, {a: newVal}); // Replacement update.
+assert.writeOK(res);
+assert.eq(res.nMatched, 1);
+if (coll.getMongo().writeMode() == "commands")
+ assert.eq(res.nModified, 1);
- // Make sure it actually changed the type.
- assert.eq(1, coll.find({a: {$type: "long"}}).itcount());
+// Make sure it actually changed the type.
+assert.eq(1, coll.find({a: {$type: "long"}}).itcount());
- // Now use a covered query to ensure the index entry has been updated.
+// Now use a covered query to ensure the index entry has been updated.
- // First make sure it's actually using a covered index scan.
- var explain = coll.explain().find({a: 2}, {_id: 0, a: 1});
- assert(isIndexOnly(db, explain));
+// First make sure it's actually using a covered index scan.
+var explain = coll.explain().find({a: 2}, {_id: 0, a: 1});
+assert(isIndexOnly(db, explain));
- var updated = coll.findOne({a: 2}, {_id: 0, a: 1});
+var updated = coll.findOne({a: 2}, {_id: 0, a: 1});
- assert(updated.a instanceof NumberLong, "Index entry did not change type");
+assert(updated.a instanceof NumberLong, "Index entry did not change type");
})();