blob: a98f46ab1dbf9ebde26e14a92659853f6e181e46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/**
* 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: [
* requires_non_retryable_writes,
* # update with multi:false is not supported on sharded collection
* assumes_unsharded_collection,
* ]
*/
(function() {
"use strict";
let coll = db.rename_operator_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");
})();
|