diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2019-05-13 17:05:50 -0400 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2019-05-15 12:17:39 -0400 |
commit | 30c603ed5efc62a97b42419a92b1210e14932361 (patch) | |
tree | 9f28478800c244a14b9e623e84f26e7abbf37a6e /jstests/change_streams | |
parent | a54c7ffd8086bc6d08b255db1293067b588eba41 (diff) | |
download | mongo-30c603ed5efc62a97b42419a92b1210e14932361.tar.gz |
SERVER-40238 New stage alias: $set => $addFields
This reverts commit c34bc93a15cbb6fe8b222f12afac5adbab6f0737.
Diffstat (limited to 'jstests/change_streams')
-rw-r--r-- | jstests/change_streams/pipeline_cannot_modify_id_field.js | 30 | ||||
-rw-r--r-- | jstests/change_streams/whitelist.js | 3 |
2 files changed, 17 insertions, 16 deletions
diff --git a/jstests/change_streams/pipeline_cannot_modify_id_field.js b/jstests/change_streams/pipeline_cannot_modify_id_field.js index 3db6c0990eb..815dad648ae 100644 --- a/jstests/change_streams/pipeline_cannot_modify_id_field.js +++ b/jstests/change_streams/pipeline_cannot_modify_id_field.js @@ -34,30 +34,30 @@ {$project: {_id: {data: "$_id._data", typeBits: "$_id._typeBits"}}}, // Fields renamed. {$project: {_id: {_typeBits: "$_id._typeBits", _data: "$_id._data"}}}, // Fields reordered. {$project: {_id: {_data: "$_id._typeBits", _typeBits: "$_id._data"}}}, // Fields swapped. - {$addFields: {_id: "newValue"}}, - {$addFields: {_id: "$otherField"}}, - {$addFields: {"_id._data": "newValue"}}, - {$addFields: {"_id._data": "$otherField"}}, - {$addFields: {"_id.otherField": "newValue"}}, // New subfield added to _id. + {$set: {_id: "newValue"}}, + {$set: {_id: "$otherField"}}, + {$set: {"_id._data": "newValue"}}, + {$set: {"_id._data": "$otherField"}}, + {$set: {"_id.otherField": "newValue"}}, // New subfield added to _id. [ {$addFields: {otherField: "$_id"}}, - {$addFields: {otherField: "newValue"}}, - {$addFields: {_id: "$otherField"}} + {$set: {otherField: "newValue"}}, + {$set: {_id: "$otherField"}} ], [ // Fields renamed. {$addFields: {newId: {data: "$_id._data", typeBits: "$_id._typeBits"}}}, - {$addFields: {_id: "$newId"}} + {$set: {_id: "$newId"}} ], [ // Fields reordered. {$addFields: {newId: {_typeBits: "$_id._typeBits", _data: "$_id._data"}}}, - {$addFields: {_id: "$newId"}} + {$set: {_id: "$newId"}} ], [ // Fields swapped. {$addFields: {newId: {_data: "$_id._typeBits", _typeBits: "$_id._data"}}}, - {$addFields: {_id: "$newId"}} + {$set: {_id: "$newId"}} ], {$replaceRoot: {newRoot: {otherField: "$_id"}}}, {$redact: {$cond: {if: {$gt: ["$_id", {}]}, then: "$$DESCEND", else: "$$PRUNE"}}} // _id:0 @@ -82,13 +82,13 @@ ], {$project: {"_id._data": 1, "_id._typeBits": 1}}, {$project: {_id: {_data: "$_id._data", _typeBits: "$_id._typeBits"}}}, - {$addFields: {_id: "$_id"}}, + {$set: {_id: "$_id"}}, {$addFields: {otherField: "newValue"}}, - {$addFields: {_id: {_data: "$_id._data", _typeBits: "$_id._typeBits"}}}, - [{$addFields: {otherField: "$_id"}}, {$addFields: {_id: "$otherField"}}], + {$set: {_id: {_data: "$_id._data", _typeBits: "$_id._typeBits"}}}, + [{$addFields: {otherField: "$_id"}}, {$set: {_id: "$otherField"}}], [ {$addFields: {newId: {_data: "$_id._data", _typeBits: "$_id._typeBits"}}}, - {$addFields: {_id: "$newId"}} + {$set: {_id: "$newId"}} ], {$replaceRoot: {newRoot: {_id: "$_id"}}}, { @@ -141,4 +141,4 @@ getMoreRes, ErrorCodes.ChangeStreamFatalError, transform); }, transform); } -}());
\ No newline at end of file +}()); diff --git a/jstests/change_streams/whitelist.js b/jstests/change_streams/whitelist.js index 12848e1e9e7..16b6ca93145 100644 --- a/jstests/change_streams/whitelist.js +++ b/jstests/change_streams/whitelist.js @@ -18,6 +18,7 @@ {$match: {_id: {$exists: true}}}, {$project: {_id: 1}}, {$addFields: {newField: 1}}, + {$set: {newField: 1}}, {$replaceRoot: {newRoot: {_id: "$_id"}}}, {$redact: "$$DESCEND"} ]; @@ -60,4 +61,4 @@ for (let bannedStage of blacklist) { assertErrorCode(coll, changeStream.concat(bannedStage), ErrorCodes.IllegalOperation); } -}());
\ No newline at end of file +}()); |