summaryrefslogtreecommitdiff
path: root/jstests/core/rename_change_target_type.js
blob: 4f210b72e678b39997137528f78cce796a17616d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test that a rename that overwrites its destination with an equivalent value of a different type
// updates the type of the destination (SERVER-32109).
// @tags: [
//   sbe_incompatible,
// ]
(function() {
"use strict";

let coll = db.rename_change_target_type;
coll.drop();

assert.commandWorked(coll.insert({to: NumberLong(100), from: 100}));
assert.commandWorked(coll.update({}, {$rename: {from: "to"}}));

let aggResult = coll.aggregate([{$project: {toType: {$type: "$to"}}}]).toArray();
assert.eq(aggResult.length, 1);
assert.eq(aggResult[0].toType, "double", "Incorrect type resulting from $rename");
})();